lantern-harness 0.1.28 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/cli/server.mjs +10 -0
  3. package/dist/500.html +4 -4
  4. package/dist/_astro/{Base.BbqRC8BF.css → Base.9LLJ6KVG.css} +1 -1
  5. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.Cd3ccDN-.js +2 -0
  6. package/dist/_astro/CaseExecBoard.CTuf_Nom.js +1 -0
  7. package/dist/_astro/{CaseGenerateApp.nE3RR7bV.js → CaseGenerateApp.CHQnkY5R.js} +1 -1
  8. package/dist/_astro/CasesLibrary.B7wyxL0p.js +21 -0
  9. package/dist/_astro/ChatApp.OW9jzZNM.js +226 -0
  10. package/dist/_astro/{DashboardBoard.DAUPgVh3.js → DashboardBoard.B5Qo5Y3e.js} +2 -2
  11. package/dist/_astro/DocsFileBrowser.DnxVsmed.js +1 -0
  12. package/dist/_astro/DocsPager.CnXEnQqa.js +1 -0
  13. package/dist/_astro/{KnowledgeLibrary.DKci9jN8.js → KnowledgeLibrary.DARUegK8.js} +1 -1
  14. package/dist/_astro/{NavLibraries.BybmHnXn.js → NavLibraries.FAj9zUuq.js} +1 -1
  15. package/dist/_astro/PluginsPage.Bof7KzU6.js +1 -0
  16. package/dist/_astro/{PluginsPage.C11wTsH4.js → PluginsPage.CRBtbpx-.js} +1 -1
  17. package/dist/_astro/{PmBugsBoard.DVhrHxD2.js → PmBugsBoard.uNPzbw-N.js} +1 -1
  18. package/dist/_astro/{PmIterationsBoard.BQPHdbpp.js → PmIterationsBoard.CjR8L71i.js} +1 -1
  19. package/dist/_astro/{PmProjectDetail.DZmqbZLO.js → PmProjectDetail.Cpug99Lt.js} +1 -1
  20. package/dist/_astro/{PmProjectsBoard.tk8cI-lO.js → PmProjectsBoard.VLqrwucj.js} +1 -1
  21. package/dist/_astro/PmRequirementsBoard.B5ypu68O.js +1 -0
  22. package/dist/_astro/PmRequirementsBoard.CdP4gEzq.js +1 -0
  23. package/dist/_astro/{PmShared.DRYCFoRc.js → PmShared.ChKKU3Ww.js} +1 -1
  24. package/dist/_astro/{PromptsLibrary.BQVt94VI.js → PromptsLibrary.CK6nLgdD.js} +1 -1
  25. package/dist/_astro/{ReportsPage.B7MOskzc.js → ReportsPage.iSM5TWMq.js} +1 -1
  26. package/dist/_astro/{ReqAnalysisBoard.C-lpty5D.js → ReqAnalysisBoard.D94a1NoW.js} +1 -1
  27. package/dist/_astro/{RequirementsLibrary._OviMClB.js → RequirementsLibrary.X89V8-QF.js} +1 -1
  28. package/dist/_astro/{SettingsDialog.CMEBX59L.js → SettingsDialog.FHQTm21D.js} +1 -1
  29. package/dist/_astro/{SpaceSwitcher.DQOG363O.js → SpaceSwitcher.MmSkP3wb.js} +1 -1
  30. package/dist/_astro/TagSelect.UUXgkMqJ.js +1 -0
  31. package/dist/_astro/TasksBoard.Z8rBCO1F.js +1 -0
  32. package/dist/_astro/{TemplatesLibrary.CEVQPDDz.js → TemplatesLibrary.DBHSAPQ0.js} +1 -1
  33. package/dist/_astro/TestStatsBoard.BtqoPuLc.js +1 -0
  34. package/dist/_astro/TodosBoard.ETI63YgA.js +1 -0
  35. package/dist/_astro/{UiAutoBoard.DegcBc_3.js → UiAutoBoard.DxrlgvI7.js} +1 -1
  36. package/dist/_astro/app-config.Bg6v8zQQ.js +1 -0
  37. package/dist/_astro/app-version.C6rzHe1M.js +1 -0
  38. package/dist/_astro/{bash-tools.D4DBYc9k.js → bash-tools.cciCC33C.js} +1 -1
  39. package/dist/_astro/case-exec.BLqTXR7U.js +1 -0
  40. package/dist/_astro/{case-gen-run.Byxy6M5X.js → case-gen-run.CKShZ1Ha.js} +1 -1
  41. package/dist/_astro/{case-types.B6MLX3iE.js → case-types.CJ5PHz59.js} +1 -1
  42. package/dist/_astro/{hydrate-cache.C0F0L04c.js → hydrate-cache.B7--LFB_.js} +1 -1
  43. package/dist/_astro/{i18n.ele1lM9e.js → i18n.CH6ZNsHf.js} +1 -1
  44. package/dist/_astro/{open-docs-in-session.D608wzlx.js → open-docs-in-session.DQ2_5fkC.js} +1 -1
  45. package/dist/_astro/plugins.SqANn3ZB.js +1 -0
  46. package/dist/_astro/{settings.DbhUT6Ao.js → settings.Cu00if4D.js} +2 -2
  47. package/dist/_astro/spaces-client.Czm-VPh5.js +1 -0
  48. package/dist/_astro/{story-review.Ckqr7i5_.js → story-review.BzBFIFt-.js} +1 -1
  49. package/dist/_astro/test-stats.Cf3_L4wu.js +1 -0
  50. package/dist/_astro/{view-prefs.DkS1ldnh.js → view-prefs.SdItxolG.js} +1 -1
  51. package/dist/case-exec/index.html +5 -5
  52. package/dist/cases/generate/index.html +5 -5
  53. package/dist/cases/library/index.html +5 -5
  54. package/dist/dashboard/index.html +5 -5
  55. package/dist/docs/changelog/index.html +73 -34
  56. package/dist/docs/install/index.html +5 -5
  57. package/dist/docs/manual/index.html +34 -14
  58. package/dist/knowledge/index.html +5 -5
  59. package/dist/plugins/index.html +5 -5
  60. package/dist/pm/bugs/index.html +5 -5
  61. package/dist/pm/iterations/index.html +5 -5
  62. package/dist/pm/projects/detail/index.html +5 -5
  63. package/dist/pm/projects/index.html +5 -5
  64. package/dist/pm/requirements/index.html +5 -5
  65. package/dist/prompts/index.html +5 -5
  66. package/dist/reports/index.html +5 -5
  67. package/dist/requirement-analysis/index.html +5 -5
  68. package/dist/requirements/index.html +5 -5
  69. package/dist/tasks/index.html +5 -5
  70. package/dist/templates/index.html +5 -5
  71. package/dist/test-automation/index.html +5 -5
  72. package/dist/test-stats/index.html +5 -5
  73. package/dist/todos/index.html +5 -5
  74. package/dist/workbench/index.html +5 -5
  75. package/docs//345/256/211/350/243/205/346/211/213/345/206/214.md +1 -1
  76. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +26 -10
  77. package/lh-plugins/lh-config.mjs +9 -0
  78. package/lh-plugins/lh-stats.mjs +308 -16
  79. package/package.json +1 -1
  80. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.CrXreVpw.js +0 -2
  81. package/dist/_astro/CaseExecBoard.cl2Od7av.js +0 -1
  82. package/dist/_astro/CasesLibrary.BkQY421S.js +0 -21
  83. package/dist/_astro/ChatApp.Y5LwY4qZ.js +0 -226
  84. package/dist/_astro/DocsFileBrowser.BdpWp8zQ.js +0 -1
  85. package/dist/_astro/DocsPager.D55FTK9d.js +0 -1
  86. package/dist/_astro/PluginsPage.DWAMKQXl.js +0 -1
  87. package/dist/_astro/PmRequirementsBoard.BjC9CEFr.js +0 -1
  88. package/dist/_astro/PmRequirementsBoard.CtuavIey.js +0 -1
  89. package/dist/_astro/TagSelect.B9W63KWq.js +0 -1
  90. package/dist/_astro/TasksBoard.Uj4XWtWz.js +0 -1
  91. package/dist/_astro/TestStatsBoard.CO4JMh4N.js +0 -1
  92. package/dist/_astro/TodosBoard.BkszTn-p.js +0 -1
  93. package/dist/_astro/app-config.DAIyT--R.js +0 -1
  94. package/dist/_astro/app-version.q6kHEFsx.js +0 -1
  95. package/dist/_astro/case-exec.BipZCK6G.js +0 -1
  96. package/dist/_astro/plugins.Di6uuouN.js +0 -1
  97. package/dist/_astro/spaces-client.OuJPy3GP.js +0 -1
  98. package/dist/_astro/test-stats.MEm3K2rB.js +0 -1
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.DAIyT--R.js";import{a as i,i as a,n as o,o as ee,s as te}from"./plugins.Di6uuouN.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.D5qXeML0.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{i as re}from"./case-types.B6MLX3iE.js";import{$ as ie,a as ae}from"./req-analysis.CIZ_cIJQ.js";import{c as l,d as u,h as oe,n as d,p as se,r as ce,u as le,v as ue}from"./project-docs.DAw9bzgk.js";import{n as de}from"./doc-roots.DAJP9Svr.js";import{a as f,c as p,d as fe,i as m,l as h,o as g,s as _,u as v}from"./prompts-meta.C_MeYq8G.js";import{i as pe,n as me,r as he,t as ge}from"./DocsFileBrowser.BdpWp8zQ.js";import{d as _e,t as ve}from"./open-docs-in-session.D608wzlx.js";import{F as ye,P as be,i as xe,r as Se}from"./case-review.DlCarphW.js";import{t as y}from"./NamePromptDialog.Csfnh5eM.js";import{m as b}from"./PmShared.DRYCFoRc.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{f as Ee,s as De,t as Oe,y as ke}from"./story-review.Ckqr7i5_.js";var x=e(t(),1),S=`tw.prompts.mounted.v1`;function Ae(){try{let e=sessionStorage.getItem(r(S));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 je(e){try{sessionStorage.setItem(r(S),JSON.stringify(e))}catch{}}var C=s(),Me=10;async function w(e=`.`){let{entries:t}=await l(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await w(e.path));return n}function Ne({path:e,enabled:t,mounted:n}){let r=v(e,n);if(!r)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,ee=g(e,n);return(0,C.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),ee&&a?(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function T(){let e=he(`prompts`),[t,r]=(0,x.useState)(!1),[s,l]=(0,x.useState)(!0),[g,S]=(0,x.useState)(e?!0:null),[T,Pe]=(0,x.useState)(()=>e??[]),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)({}),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(()=>i()),[I,Fe]=(0,x.useState)(()=>Ae()),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),U=me(T,Me,`prompts`),W=(0,x.useRef)(!1),G=(0,x.useRef)(!1),K=(0,x.useRef)(!1),q=(0,x.useRef)(!1),J=(0,x.useRef)(!1),Y=(0,x.useCallback)(async()=>{D(null);try{let e=await w(`.`);Pe(e),pe(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e))}},[]);(0,x.useEffect)(()=>{g&&P.reqAnalysis===!0&&!W.current&&(T.some(e=>e.name===`需求分析提示词.md`)||(W.current=!0,ie(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.reqAnalysis,T,Y]),(0,x.useEffect)(()=>{g&&P.storyReview===!0&&!G.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(G.current=!0,De(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.storyReview,T,Y]),(0,x.useEffect)(()=>{g&&P.testPoints===!0&&!K.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(K.current=!0,ke(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.testPoints,T,Y]),(0,x.useEffect)(()=>{g&&P.caseReview===!0&&!q.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseReview,T,Y]),(0,x.useEffect)(()=>{g&&P.caseBlindspot===!0&&!J.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(J.current=!0,be(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseBlindspot,T,Y]),(0,x.useEffect)(()=>{let e=ee(e=>{l(!!e.prompts),F(e)});return n().then(()=>{l(a(`prompts`)),F(i()),r(!0)}),e},[]),(0,x.useEffect)(()=>{t&&s&&(async()=>{await ce(`prompts`)?(await _e().catch(()=>null),await Y(),S(!0)):S(!1)})()},[t,s,Y]);let X=(0,x.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=t?await Ce().catch(()=>null):null;Fe(r=>{let i={};if(e)for(let t of e)i[p(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[p(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(P.reqAnalysis&&(i[p(ae)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(xe)]=`caseReview`),P.caseBlindspot&&(i[p(Se)]=`caseBlindspot`),P.caseGen)for(let e of re()){let t=(e.promptPath??``).trim();t&&(i[p(t)]=`caseGen`)}return je(i),i})},[P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen]);(0,x.useEffect)(()=>{if(!t||!s)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,s,P.uiAuto,P.reports,P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen,X]);let Z=(0,x.useMemo)(()=>Object.keys(A).filter(e=>A[e]),[A]),Q=(0,x.useCallback)(e=>{let t=v(e,I);return!t||t===`system`||fe(e)?``:P[t]===!0?t:``},[I,P]);async function Ie(e){k(!0),D(null);try{await le(`prompts`,e.path)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}}async function Le(e){k(!0),D(null);try{await ve(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e)),k(!1)}}function Re(e){if(_(e.path)){D(`默认提示词不可删除`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else N({kind:`one`,entry:e})}function ze(e){if(_(e.path)){D(`默认提示词不可改名`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else R(e),H(``)}function Be(e){B(e),H(``)}async function Ve(){let e=M;if(e){N(null),k(!0),D(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)_(n)||m(n,P)||Q(n)?t+=1:await d(`prompts`,n);t&&D(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),j({})}await Y(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),c(`删除失败:${t}`,`error`)}finally{k(!1)}}}function He(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:D(te(`promptGen`))}let $=(0,x.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function Ue(e){let t=L;if(!t)return;let n=e.trim();if(!n||n===t.name){R(null),H(``);return}let r=$(u(t.path),n,t.path);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{await oe(`prompts`,t.path,n),R(null),await Y(),c(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`重命名失败:${t}`,`error`)}finally{k(!1)}}}async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n)return;let r=$(u(t.path),n);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{let{content:e}=await se(`prompts`,t.path);await ue(`prompts`,u(t.path)===`.`?n:`${u(t.path)}/${n}`,e),B(null),await Y(),c(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`复制失败:${t}`,`error`)}finally{k(!1)}}}let Ge=M?.kind===`one`?`删除「${M.entry.name}」?将从 ${de(`prompts`)} 中移除。`:M?.kind===`batch`?`确认删除已选中的 ${M.paths.length} 个提示词?此操作不可恢复。`:``;return t?s?g===null?(0,C.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,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,C.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,C.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[U.query.trim()?(0,C.jsxs)(C.Fragment,{children:[`匹配 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:U.filtered.length}),` 个`,(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,C.jsxs)(C.Fragment,{children:[`共 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Z.length>0?(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,C.jsx)(`button`,{type:`button`,disabled:O||Z.length===0,onClick:()=>N({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,C.jsx)(`button`,{type:`button`,disabled:O,onClick:He,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:`生成提示词`})]}),E?(0,C.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:E}):null,(0,C.jsx)(ge,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:U.filtered,pageFiles:U.pageFiles,query:U.query,onQuery:U.setQuery,sortBy:U.sortBy,onSortBy:U.setSortBy,page:U.page,totalPages:U.totalPages,pageSize:U.pageSize,onPage:U.setPage,onPageSize:U.setPageSize,busy:O,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!f(e.path,P)&&!Q(e.path),selected:A,onToggleRow:e=>j(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>j(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Ie(e),extraColumn:{header:`关联插件`,render:e=>(0,C.jsx)(Ne,{path:e.path,enabled:P,mounted:I})},renderNameAction:e=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`重命名 ${e.name}`,onClick:()=>ze(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,C.jsx)(b,{name:`pencil`,size:12})}),(0,C.jsx)(`button`,{type:`button`,disabled:O,"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,C.jsx)(b,{name:`copy`,size:12})})]}),renderActions:e=>{let t=f(e.path,P)||!!Q(e.path);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void Le(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,C.jsx)(`button`,{type:`button`,disabled:O||t,"aria-label":`删除 ${e.name}`,onClick:()=>Re(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,C.jsx)(b,{name:`trash`,size:12})})]})}}),(0,C.jsx)(y,{open:L!=null,title:`重命名提示词`,label:`文件名称`,initialValue:L?.name??``,lockExtension:!0,confirmLabel:`保存`,error:V,onClose:()=>{R(null),H(``)},onConfirm:e=>void Ue(e)}),(0,C.jsx)(y,{open:z!=null,title:`复制提示词`,label:`新文件名称`,initialValue:z?z.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:V,onClose:()=>{B(null),H(``)},onConfirm:e=>void We(e)}),(0,C.jsx)(ne,{open:M!=null,title:M?.kind===`batch`?`批量删除`:`删除提示词`,message:Ge,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void Ve()})]}):(0,C.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,C.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:te(`prompts`)}):(0,C.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,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{T as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.Bg6v8zQQ.js";import{a as i,i as a,n as o,o as ee,s as te}from"./plugins.SqANn3ZB.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{t as ne}from"./ConfirmDialog.D5qXeML0.js";import{showToast as c}from"./Toast.BO2NFckG.js";import{i as re}from"./case-types.CJ5PHz59.js";import{$ as ie,a as ae}from"./req-analysis.CIZ_cIJQ.js";import{c as l,d as u,h as oe,n as d,p as se,r as ce,u as le,v as ue}from"./project-docs.DAw9bzgk.js";import{n as de}from"./doc-roots.DAJP9Svr.js";import{a as f,c as p,d as fe,i as m,l as h,o as g,s as _,u as v}from"./prompts-meta.C_MeYq8G.js";import{i as pe,n as me,r as he,t as ge}from"./DocsFileBrowser.DnxVsmed.js";import{d as _e,t as ve}from"./open-docs-in-session.DQ2_5fkC.js";import{F as ye,P as be,i as xe,r as Se}from"./case-review.DlCarphW.js";import{t as y}from"./NamePromptDialog.Csfnh5eM.js";import{m as b}from"./PmShared.ChKKU3Ww.js";import{r as Ce}from"./report-prompt.CAfZ6RIo.js";import{g as we,s as Te}from"./ui-auto.BmC9JJ_X.js";import{f as Ee,s as De,t as Oe,y as ke}from"./story-review.BzBFIFt-.js";var x=e(t(),1),S=`tw.prompts.mounted.v1`;function Ae(){try{let e=sessionStorage.getItem(r(S));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 je(e){try{sessionStorage.setItem(r(S),JSON.stringify(e))}catch{}}var C=s(),Me=10;async function w(e=`.`){let{entries:t}=await l(`prompts`,e),n=[];for(let e of t)e.type===`file`?n.push(e):n.push(...await w(e.path));return n}function Ne({path:e,enabled:t,mounted:n}){let r=v(e,n);if(!r)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:`未关联`});if(r===`system`)return(0,C.jsx)(`span`,{className:`text-[11px] text-stone-600`,children:`系统默认`});let i=o(r)?.name??r,a=t[r]===!0,ee=g(e,n);return(0,C.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,C.jsx)(`span`,{className:`truncate text-[11px] text-stone-600`,children:i}),ee&&a?(0,C.jsx)(`span`,{className:`shrink-0 rounded bg-(--tw-accent-soft) px-1 text-[10px] text-(--tw-accent)`,children:`引用中`}):null]})}function T(){let e=he(`prompts`),[t,r]=(0,x.useState)(!1),[s,l]=(0,x.useState)(!0),[g,S]=(0,x.useState)(e?!0:null),[T,Pe]=(0,x.useState)(()=>e??[]),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(!1),[A,j]=(0,x.useState)({}),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(()=>i()),[I,Fe]=(0,x.useState)(()=>Ae()),[L,R]=(0,x.useState)(null),[z,B]=(0,x.useState)(null),[V,H]=(0,x.useState)(``),U=me(T,Me,`prompts`),W=(0,x.useRef)(!1),G=(0,x.useRef)(!1),K=(0,x.useRef)(!1),q=(0,x.useRef)(!1),J=(0,x.useRef)(!1),Y=(0,x.useCallback)(async()=>{D(null);try{let e=await w(`.`);Pe(e),pe(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e))}},[]);(0,x.useEffect)(()=>{g&&P.reqAnalysis===!0&&!W.current&&(T.some(e=>e.name===`需求分析提示词.md`)||(W.current=!0,ie(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.reqAnalysis,T,Y]),(0,x.useEffect)(()=>{g&&P.storyReview===!0&&!G.current&&(T.some(e=>e.name===`用户故事审查提示词.md`)||(G.current=!0,De(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.storyReview,T,Y]),(0,x.useEffect)(()=>{g&&P.testPoints===!0&&!K.current&&(T.some(e=>e.name===`测试点生成提示词.md`)||(K.current=!0,ke(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.testPoints,T,Y]),(0,x.useEffect)(()=>{g&&P.caseReview===!0&&!q.current&&(T.some(e=>e.name===`用例质量评审提示词.md`)||(q.current=!0,ye(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseReview,T,Y]),(0,x.useEffect)(()=>{g&&P.caseBlindspot===!0&&!J.current&&(T.some(e=>e.name===`场景遗漏补全提示词.md`)||(J.current=!0,be(!0).then(()=>Y()).catch(()=>void 0)))},[g,P.caseBlindspot,T,Y]),(0,x.useEffect)(()=>{let e=ee(e=>{l(!!e.prompts),F(e)});return n().then(()=>{l(a(`prompts`)),F(i()),r(!0)}),e},[]),(0,x.useEffect)(()=>{t&&s&&(async()=>{await ce(`prompts`)?(await _e().catch(()=>null),await Y(),S(!0)):S(!1)})()},[t,s,Y]);let X=(0,x.useCallback)(async()=>{let e=await Te(),t=a(`reports`),n=t?await Ce().catch(()=>null):null;Fe(r=>{let i={};if(e)for(let t of e)i[p(t)]=`uiAuto`;else for(let[e,t]of Object.entries(r))t===`uiAuto`&&(i[e]=t);if(t){if(n?.promptFile)i[p(n.promptFile)]=`reports`;else for(let[e,t]of Object.entries(r))t===`reports`&&(i[e]=t)}if(P.reqAnalysis&&(i[p(ae)]=`reqAnalysis`),P.storyReview&&(i[p(Oe)]=`storyReview`),P.testPoints&&(i[p(Ee)]=`testPoints`),P.caseReview&&(i[p(xe)]=`caseReview`),P.caseBlindspot&&(i[p(Se)]=`caseBlindspot`),P.caseGen)for(let e of re()){let t=(e.promptPath??``).trim();t&&(i[p(t)]=`caseGen`)}return je(i),i})},[P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen]);(0,x.useEffect)(()=>{if(!t||!s)return;X();let e=()=>{document.visibilityState===`visible`&&X()};document.addEventListener(`visibilitychange`,e);let n=we(()=>void X());return()=>{document.removeEventListener(`visibilitychange`,e),n()}},[t,s,P.uiAuto,P.reports,P.reqAnalysis,P.storyReview,P.testPoints,P.caseReview,P.caseBlindspot,P.caseGen,X]);let Z=(0,x.useMemo)(()=>Object.keys(A).filter(e=>A[e]),[A]),Q=(0,x.useCallback)(e=>{let t=v(e,I);return!t||t===`system`||fe(e)?``:P[t]===!0?t:``},[I,P]);async function Ie(e){k(!0),D(null);try{await le(`prompts`,e.path)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(!1)}}async function Le(e){k(!0),D(null);try{await ve(`prompts`,e)}catch(e){D(e instanceof Error?e.message:String(e)),k(!1)}}function Re(e){if(_(e.path)){D(`默认提示词不可删除`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再删除`)}else N({kind:`one`,entry:e})}function ze(e){if(_(e.path)){D(`默认提示词不可改名`);return}if(m(e.path,P)){D(h(e.path,P));return}let t=Q(e.path);if(t){let e=o(t)?.name??t;D(`这份提示词正被「${e}」的项目挂载,先在那里换一份再改名`)}else R(e),H(``)}function Be(e){B(e),H(``)}async function Ve(){let e=M;if(e){N(null),k(!0),D(null);try{if(e.kind===`one`)await d(`prompts`,e.entry.path);else{let t=0;for(let n of e.paths)_(n)||m(n,P)||Q(n)?t+=1:await d(`prompts`,n);t&&D(`有 ${t} 个提示词仍被插件或项目引用,已跳过;先解除引用再删。`),j({})}await Y(),c(e.kind===`one`?`已删除「${e.entry.name}」`:`已删除 ${e.paths.length} 个提示词`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);D(t),c(`删除失败:${t}`,`error`)}finally{k(!1)}}}function He(){a(`promptGen`)?window.location.href=`/workbench/?plugin=promptGen`:D(te(`promptGen`))}let $=(0,x.useCallback)((e,t,n=``)=>{let r=(e===`.`?t:`${e}/${t}`).toLowerCase(),i=T.find(e=>e.path.toLowerCase()===r&&e.path.toLowerCase()!==n.toLowerCase());return i?i.name:``},[T]);async function Ue(e){let t=L;if(!t)return;let n=e.trim();if(!n||n===t.name){R(null),H(``);return}let r=$(u(t.path),n,t.path);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{await oe(`prompts`,t.path,n),R(null),await Y(),c(`已重命名为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`重命名失败:${t}`,`error`)}finally{k(!1)}}}async function We(e){let t=z;if(!t)return;let n=e.trim();if(!n)return;let r=$(u(t.path),n);if(r)H(`已存在同名文件「${r}」,换个名字再试`);else{k(!0),H(``);try{let{content:e}=await se(`prompts`,t.path);await ue(`prompts`,u(t.path)===`.`?n:`${u(t.path)}/${n}`,e),B(null),await Y(),c(`已复制为「${n}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);H(t),c(`复制失败:${t}`,`error`)}finally{k(!1)}}}let Ge=M?.kind===`one`?`删除「${M.entry.name}」?将从 ${de(`prompts`)} 中移除。`:M?.kind===`batch`?`确认删除已选中的 ${M.paths.length} 个提示词?此操作不可恢复。`:``;return t?s?g===null?(0,C.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,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):g?(0,C.jsxs)(`section`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex flex-col min-h-0`,children:[(0,C.jsxs)(`div`,{className:`shrink-0 px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0`,children:[U.query.trim()?(0,C.jsxs)(C.Fragment,{children:[`匹配 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:U.filtered.length}),` 个`,(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 共 `,T.length]})]}):(0,C.jsxs)(C.Fragment,{children:[`共 `,(0,C.jsx)(`span`,{className:`font-medium text-stone-800`,children:T.length}),` 个提示词`]}),Z.length>0?(0,C.jsxs)(`span`,{className:`text-stone-400`,children:[` · 已选 `,Z.length]}):null]}),(0,C.jsx)(`button`,{type:`button`,disabled:O||Z.length===0,onClick:()=>N({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,C.jsx)(`button`,{type:`button`,disabled:O,onClick:He,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:`生成提示词`})]}),E?(0,C.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:E}):null,(0,C.jsx)(ge,{resizeKey:`docs:prompts:cols:v1`,files:T,filtered:U.filtered,pageFiles:U.pageFiles,query:U.query,onQuery:U.setQuery,sortBy:U.sortBy,onSortBy:U.setSortBy,page:U.page,totalPages:U.totalPages,pageSize:U.pageSize,onPage:U.setPage,onPageSize:U.setPageSize,busy:O,emptyText:`暂无提示词,点击「生成提示词」前往我的工作台。`,searchPlaceholder:`搜索文件名或路径…`,selectable:e=>!f(e.path,P)&&!Q(e.path),selected:A,onToggleRow:e=>j(t=>({...t,[e]:!t[e]})),onSelectPage:(e,t)=>j(n=>{let r={...n};for(let n of e)t?r[n]=!0:delete r[n];return r}),onRowDoubleClick:e=>void Ie(e),extraColumn:{header:`关联插件`,render:e=>(0,C.jsx)(Ne,{path:e.path,enabled:P,mounted:I})},renderNameAction:e=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,"aria-label":`重命名 ${e.name}`,onClick:()=>ze(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,C.jsx)(b,{name:`pencil`,size:12})}),(0,C.jsx)(`button`,{type:`button`,disabled:O,"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,C.jsx)(b,{name:`copy`,size:12})})]}),renderActions:e=>{let t=f(e.path,P)||!!Q(e.path);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`button`,{type:`button`,disabled:O,onClick:()=>void Le(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,C.jsx)(`button`,{type:`button`,disabled:O||t,"aria-label":`删除 ${e.name}`,onClick:()=>Re(e),className:`tw-icon-danger inline-flex h-6 w-6 items-center justify-center rounded`,children:(0,C.jsx)(b,{name:`trash`,size:12})})]})}}),(0,C.jsx)(y,{open:L!=null,title:`重命名提示词`,label:`文件名称`,initialValue:L?.name??``,lockExtension:!0,confirmLabel:`保存`,error:V,onClose:()=>{R(null),H(``)},onConfirm:e=>void Ue(e)}),(0,C.jsx)(y,{open:z!=null,title:`复制提示词`,label:`新文件名称`,initialValue:z?z.name.replace(/(\.[^.]+)?$/,e=>`(副本)${e}`):``,lockExtension:!0,confirmLabel:`复制`,error:V,onClose:()=>{B(null),H(``)},onConfirm:e=>void We(e)}),(0,C.jsx)(ne,{open:M!=null,title:M?.kind===`batch`?`批量删除`:`删除提示词`,message:Ge,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>N(null),onConfirm:()=>void Ve()})]}):(0,C.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,C.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:te(`prompts`)}):(0,C.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,C.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center`,children:(0,C.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{T as default};
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.DAIyT--R.js";import{i,o as a,s as o}from"./plugins.Di6uuouN.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.D55FTK9d.js";import{t as u}from"./SelectDropdown.apWlFGbA.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{a as ee,c as te,i as ne,o as re,s as f,t as p}from"./report-prompt.CAfZ6RIo.js";var m=e(t(),1),h=`tw.reports.kind.v1`,g=Object.keys(p);function _(e){return typeof e==`string`&&g.includes(e)}function v(e=`day`){try{let t=localStorage.getItem(r(h));return _(t)?t:e}catch{return e}}function y(e){if(_(e))try{localStorage.setItem(r(h),e)}catch{}}var b=s(),x=[`day`,`week`,`month`],S=20,C=`tw.reports.page-size.v1`;function w(e){return e.replace(/\.(md|markdown|txt)$/i,``)}function T(e){return e.replace(/\.(md|markdown|txt|html?)$/i,``)}function E(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}/${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function ie(e){return!Number.isFinite(e)||e<=0?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var ae={day:`日`,week:`周`,month:`月`};function D(){let[e,t]=(0,m.useState)(!1),[r,s]=(0,m.useState)(!0),[h,g]=(0,m.useState)(()=>v()),_=(0,m.useRef)(h),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(``),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(null),[F,I]=(0,m.useState)(``),[L,R]=(0,m.useState)([]),[z,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(1),[G,K]=c(S,C),q=(0,m.useCallback)(async(e,t)=>{M(!0),P(null);try{if(t?.ensure)try{await te(!0)}catch{}let n=await ee(e);O(n.items),A(n.dir)}catch(e){let t=e instanceof Error?e.message:String(e);P(t.includes(`404`)?`工作汇报需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`:t),O([])}finally{M(!1)}},[]);(0,m.useEffect)(()=>{let e=a(e=>s(!!e.reports));return n().then(()=>{s(i(`reports`)),t(!0)}),e},[]);let J=(0,m.useCallback)(async()=>{try{let e=await ne();R(e.items),B(e.promptFile),e.promptFile||d(`没有读到「提示词管理」里的工作汇报提示词,写汇报前请先在提示词管理里补一份。`,`error`)}catch(e){let t=e instanceof Error?e.message:String(e);d(`读取工作汇报提示词失败:${t}`,`error`)}},[]);(0,m.useEffect)(()=>{e&&r&&(async()=>{await q(_.current,{ensure:!0}),await J()})()},[e,r,q,J]);function oe(e){y(e),e!==h&&(g(e),W(1),O([]),q(e))}async function se(e){if(e&&e!==z){H(!0),P(null);try{let t=await f(e);B(t),R(e=>e.map(e=>({...e,selected:e.name===t})))}catch(e){let t=e instanceof Error?e.message:String(e);P(t),d(`切换提示词失败:${t}`,`error`)}finally{H(!1)}}}let ce=(0,m.useMemo)(()=>L.length?L.map(e=>({value:e.name,label:w(e.name)})):[{value:``,label:`暂无提示词`}],[L]),Y=(0,m.useMemo)(()=>[...D].sort((e,t)=>t.generatedAt-e.generatedAt),[D]),X=Math.max(1,Math.ceil(Y.length/G)),Z=Math.min(U,X),le=(0,m.useMemo)(()=>Y.slice((Z-1)*G,Z*G),[Y,Z,G]),ue=`/workbench/?report=${h}`;async function Q(e){if(!F){I(e.name),P(null);try{await re(e.kind,e.name)}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(``)}}}if(!e)return(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex items-center justify-center min-h-[220px]`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!r)return(0,b.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:o(`reports`)});let $=Y[0];return(0,b.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 border-b border-stone-100 px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>oe(e),className:`h-8 rounded-md px-3 text-sm transition-colors ${h===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:p[e]},e))}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(u,{className:`w-[172px]`,flat:!0,options:ce,value:z,onChange:e=>void se(e),disabled:!L.length||V,ariaLabel:`选择工作汇报提示词`,menuMinWidth:200}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void(async()=>{await q(h),await J()})(),disabled:j,"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800 disabled:opacity-40`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,b.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,b.jsx)(`a`,{href:ue,className:`inline-flex h-9 items-center whitespace-nowrap rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`去工作台写汇报`})]})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-stone-400`,children:[(0,b.jsxs)(`span`,{children:[p[h],` · 共 `,D.length,` 篇`]}),$?(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`最近生成 `,E($.generatedAt)]}):null,(0,b.jsx)(`span`,{className:`min-w-0 truncate`,children:k||`—`}),(0,b.jsx)(`span`,{className:`ml-auto hidden shrink-0 sm:inline`,children:`点击卡片用系统默认程序打开`})]})]}),N?(0,b.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,b.jsx)(`span`,{className:`min-w-0 flex-1`,children:N}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>P(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,b.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-stone-50/60 p-3 sm:p-4`,children:j&&D.length===0?(0,b.jsx)(`div`,{className:`flex min-h-[180px] items-center justify-center`,"aria-busy":`true`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):D.length===0?(0,b.jsxs)(`div`,{className:`flex min-h-[260px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-stone-300 px-6 py-10 text-center`,children:[(0,b.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,b.jsx)(`path`,{d:`M14 3v5h5`}),(0,b.jsx)(`path`,{d:`M9 13h6M9 17h4`})]})}),(0,b.jsxs)(`div`,{className:`text-sm font-medium text-stone-700`,children:[`还没有`,p[h]]}),(0,b.jsxs)(`p`,{className:`max-w-md text-xs leading-5 text-stone-400`,children:[`保存到 `,k||`工作汇报/${p[h]}`,` 后会自动出现在这里。`]})]}):(0,b.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,380px),1fr))] gap-2.5`,children:le.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,onClick:()=>void Q(e),disabled:!!F,className:`group flex w-full items-center gap-3 rounded-xl border border-stone-200 bg-white px-3.5 py-3 text-left transition-colors hover:border-[#3370ff]/50 hover:bg-stone-50 disabled:cursor-progress disabled:opacity-60`,children:[(0,b.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-stone-100 text-[13px] font-semibold text-stone-600`,children:ae[e.kind]}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`span`,{className:`block truncate text-sm font-medium text-stone-800 transition-colors group-hover:text-[#3370ff]`,children:T(e.name)}),(0,b.jsxs)(`span`,{className:`mt-0.5 block truncate text-xs text-stone-400 tabular-nums`,children:[E(e.generatedAt),` · `,ie(e.size)]})]}),(0,b.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 text-xs text-stone-400 transition-colors group-hover:text-[#3370ff]`,children:[F===e.name?`打开中…`:`打开`,(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,b.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})]})},e.name))})}),D.length>0?(0,b.jsx)(l,{page:Z,totalPages:X,pageSize:G,busy:j,onPage:W,onPageSize:e=>{K(e),W(1)}}):(0,b.jsx)(`div`,{className:`pb-2.5`})]})}export{D as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.Bg6v8zQQ.js";import{i,o as a,s as o}from"./plugins.SqANn3ZB.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.CnXEnQqa.js";import{t as u}from"./SelectDropdown.apWlFGbA.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{a as ee,c as te,i as ne,o as re,s as f,t as p}from"./report-prompt.CAfZ6RIo.js";var m=e(t(),1),h=`tw.reports.kind.v1`,g=Object.keys(p);function _(e){return typeof e==`string`&&g.includes(e)}function v(e=`day`){try{let t=localStorage.getItem(r(h));return _(t)?t:e}catch{return e}}function y(e){if(_(e))try{localStorage.setItem(r(h),e)}catch{}}var b=s(),x=[`day`,`week`,`month`],S=20,C=`tw.reports.page-size.v1`;function w(e){return e.replace(/\.(md|markdown|txt)$/i,``)}function T(e){return e.replace(/\.(md|markdown|txt|html?)$/i,``)}function E(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}/${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function ie(e){return!Number.isFinite(e)||e<=0?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var ae={day:`日`,week:`周`,month:`月`};function D(){let[e,t]=(0,m.useState)(!1),[r,s]=(0,m.useState)(!0),[h,g]=(0,m.useState)(()=>v()),_=(0,m.useRef)(h),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(``),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(null),[F,I]=(0,m.useState)(``),[L,R]=(0,m.useState)([]),[z,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(1),[G,K]=c(S,C),q=(0,m.useCallback)(async(e,t)=>{M(!0),P(null);try{if(t?.ensure)try{await te(!0)}catch{}let n=await ee(e);O(n.items),A(n.dir)}catch(e){let t=e instanceof Error?e.message:String(e);P(t.includes(`404`)?`工作汇报需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`:t),O([])}finally{M(!1)}},[]);(0,m.useEffect)(()=>{let e=a(e=>s(!!e.reports));return n().then(()=>{s(i(`reports`)),t(!0)}),e},[]);let J=(0,m.useCallback)(async()=>{try{let e=await ne();R(e.items),B(e.promptFile),e.promptFile||d(`没有读到「提示词管理」里的工作汇报提示词,写汇报前请先在提示词管理里补一份。`,`error`)}catch(e){let t=e instanceof Error?e.message:String(e);d(`读取工作汇报提示词失败:${t}`,`error`)}},[]);(0,m.useEffect)(()=>{e&&r&&(async()=>{await q(_.current,{ensure:!0}),await J()})()},[e,r,q,J]);function oe(e){y(e),e!==h&&(g(e),W(1),O([]),q(e))}async function se(e){if(e&&e!==z){H(!0),P(null);try{let t=await f(e);B(t),R(e=>e.map(e=>({...e,selected:e.name===t})))}catch(e){let t=e instanceof Error?e.message:String(e);P(t),d(`切换提示词失败:${t}`,`error`)}finally{H(!1)}}}let ce=(0,m.useMemo)(()=>L.length?L.map(e=>({value:e.name,label:w(e.name)})):[{value:``,label:`暂无提示词`}],[L]),Y=(0,m.useMemo)(()=>[...D].sort((e,t)=>t.generatedAt-e.generatedAt),[D]),X=Math.max(1,Math.ceil(Y.length/G)),Z=Math.min(U,X),le=(0,m.useMemo)(()=>Y.slice((Z-1)*G,Z*G),[Y,Z,G]),ue=`/workbench/?report=${h}`;async function Q(e){if(!F){I(e.name),P(null);try{await re(e.kind,e.name)}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(``)}}}if(!e)return(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex items-center justify-center min-h-[220px]`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!r)return(0,b.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:o(`reports`)});let $=Y[0];return(0,b.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 border-b border-stone-100 px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>oe(e),className:`h-8 rounded-md px-3 text-sm transition-colors ${h===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:p[e]},e))}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(u,{className:`w-[172px]`,flat:!0,options:ce,value:z,onChange:e=>void se(e),disabled:!L.length||V,ariaLabel:`选择工作汇报提示词`,menuMinWidth:200}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void(async()=>{await q(h),await J()})(),disabled:j,"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800 disabled:opacity-40`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,b.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,b.jsx)(`a`,{href:ue,className:`inline-flex h-9 items-center whitespace-nowrap rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`去工作台写汇报`})]})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-stone-400`,children:[(0,b.jsxs)(`span`,{children:[p[h],` · 共 `,D.length,` 篇`]}),$?(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`最近生成 `,E($.generatedAt)]}):null,(0,b.jsx)(`span`,{className:`min-w-0 truncate`,children:k||`—`}),(0,b.jsx)(`span`,{className:`ml-auto hidden shrink-0 sm:inline`,children:`点击卡片用系统默认程序打开`})]})]}),N?(0,b.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,b.jsx)(`span`,{className:`min-w-0 flex-1`,children:N}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>P(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,b.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-stone-50/60 p-3 sm:p-4`,children:j&&D.length===0?(0,b.jsx)(`div`,{className:`flex min-h-[180px] items-center justify-center`,"aria-busy":`true`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):D.length===0?(0,b.jsxs)(`div`,{className:`flex min-h-[260px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-stone-300 px-6 py-10 text-center`,children:[(0,b.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,b.jsx)(`path`,{d:`M14 3v5h5`}),(0,b.jsx)(`path`,{d:`M9 13h6M9 17h4`})]})}),(0,b.jsxs)(`div`,{className:`text-sm font-medium text-stone-700`,children:[`还没有`,p[h]]}),(0,b.jsxs)(`p`,{className:`max-w-md text-xs leading-5 text-stone-400`,children:[`保存到 `,k||`工作汇报/${p[h]}`,` 后会自动出现在这里。`]})]}):(0,b.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,380px),1fr))] gap-2.5`,children:le.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,onClick:()=>void Q(e),disabled:!!F,className:`group flex w-full items-center gap-3 rounded-xl border border-stone-200 bg-white px-3.5 py-3 text-left transition-colors hover:border-[#3370ff]/50 hover:bg-stone-50 disabled:cursor-progress disabled:opacity-60`,children:[(0,b.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-stone-100 text-[13px] font-semibold text-stone-600`,children:ae[e.kind]}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`span`,{className:`block truncate text-sm font-medium text-stone-800 transition-colors group-hover:text-[#3370ff]`,children:T(e.name)}),(0,b.jsxs)(`span`,{className:`mt-0.5 block truncate text-xs text-stone-400 tabular-nums`,children:[E(e.generatedAt),` · `,ie(e.size)]})]}),(0,b.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 text-xs text-stone-400 transition-colors group-hover:text-[#3370ff]`,children:[F===e.name?`打开中…`:`打开`,(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,b.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})]})},e.name))})}),D.length>0?(0,b.jsx)(l,{page:Z,totalPages:X,pageSize:G,busy:j,onPage:W,onPageSize:e=>{K(e),W(1)}}):(0,b.jsx)(`div`,{className:`pb-2.5`})]})}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.DAIyT--R.js";import{s as r}from"./plugins.Di6uuouN.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.DkS1ldnh.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 ee}from"./SelectDropdown.apWlFGbA.js";import{showToast as v}from"./Toast.BO2NFckG.js";import{$ as te,A as ne,B as re,C as y,D as b,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 me,P as he,Q as ge,R as _e,S as ve,T as x,U as ye,V as be,W as S,X as xe,Y as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,et as Oe,f as ke,g as Ae,i as je,j as Me,k as Ne,l as Pe,m as Fe,n as C,nt as Ie,o as Le,p as Re,q as ze,r as w,rt as T,s as Be,t as Ve,tt as He,u as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./req-analysis.CIZ_cIJQ.js";import{o as Ye}from"./project-docs.DAw9bzgk.js";import{s as Xe}from"./llm.DyweO-KK.js";import{m as Ze,p as Qe,u as $e}from"./settings.DbhUT6Ao.js";import{t as et}from"./MultiSelectDropdown.BHxW9XLR.js";import{S as E,_ as tt,g as nt,k as rt,m as D,u as it}from"./PmShared.DRYCFoRc.js";import{_ as at,a as ot,c as st,d as ct,f as lt,g as ut,h as dt,i as ft,l as pt,m as mt,n as ht,o as gt,p as O,r as _t,s as vt,u as yt,y as bt}from"./story-review.Ckqr7i5_.js";import{t as xt}from"./hydrate-cache.C0F0L04c.js";var k=e(t(),1),St=`可用工具(只调用这些,不要自己编工具名):
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Bg6v8zQQ.js";import{s as r}from"./plugins.SqANn3ZB.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.SdItxolG.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 ee}from"./SelectDropdown.apWlFGbA.js";import{showToast as v}from"./Toast.BO2NFckG.js";import{$ as te,A as ne,B as re,C as y,D as b,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 me,P as he,Q as ge,R as _e,S as ve,T as x,U as ye,V as be,W as S,X as xe,Y as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,et as Oe,f as ke,g as Ae,i as je,j as Me,k as Ne,l as Pe,m as Fe,n as C,nt as Ie,o as Le,p as Re,q as ze,r as w,rt as T,s as Be,t as Ve,tt as He,u as Ue,v as We,w as Ge,x as Ke,y as qe,z as Je}from"./req-analysis.CIZ_cIJQ.js";import{o as Ye}from"./project-docs.DAw9bzgk.js";import{s as Xe}from"./llm.DyweO-KK.js";import{m as Ze,p as Qe,u as $e}from"./settings.Cu00if4D.js";import{t as et}from"./MultiSelectDropdown.BHxW9XLR.js";import{S as E,_ as tt,g as nt,k as rt,m as D,u as it}from"./PmShared.ChKKU3Ww.js";import{_ as at,a as ot,c as st,d as ct,f as lt,g as ut,h as dt,i as ft,l as pt,m as mt,n as ht,o as gt,p as O,r as _t,s as vt,u as yt,y as bt}from"./story-review.BzBFIFt-.js";import{t as xt}from"./hydrate-cache.B7--LFB_.js";var k=e(t(),1),St=`可用工具(只调用这些,不要自己编工具名):
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 不变);用户变更当前点内容时用。
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.DAIyT--R.js";import{i as r,o as i,s as a}from"./plugins.Di6uuouN.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.D5qXeML0.js";import{n as c,t as ee}from"./DocsPager.D55FTK9d.js";import{showToast as l}from"./Toast.BO2NFckG.js";import{a as te,c as u,d as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,p as le,r as ue,s as d,t as de,u as fe}from"./project-docs.DAw9bzgk.js";import{n as pe}from"./doc-roots.DAJP9Svr.js";import{t as f}from"./NamePromptDialog.Csfnh5eM.js";import{n as me,t as he}from"./docs-format.BlGh-XA_.js";import{t as ge}from"./useListAnim.BoerpmsB.js";var p=e(t(),1),m=o(),_e=5;function h({className:e=`w-4 h-4`,open:t=!1}){return(0,m.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,m.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}):(0,m.jsx)(`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`})})}function g({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,m.jsx)(`path`,{d:`m15 5 4 4`})]})}function _({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,m.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,m.jsx)(`path`,{d:`M10 11v6`}),(0,m.jsx)(`path`,{d:`M14 11v6`})]})}function v({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(h,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,m.jsx)(v,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function y(){let[e,t]=(0,p.useState)(()=>r(`requirements`)),[o,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[S,ve]=(0,p.useState)([]),[ye,be]=(0,p.useState)(0),[C,w]=(0,p.useState)(`.`),[T,E]=(0,p.useState)([]),[xe,D]=(0,p.useState)({}),[O,Se]=(0,p.useState)(!0),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[Ce,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(null),[we,B]=(0,p.useState)(1),[V,Te]=c(_e),[Ee,H]=(0,p.useState)(null),U=(0,p.useRef)(null),{cls:De,play:W}=ge(),G=(0,p.useCallback)(async()=>{let e=await ae(`requirements`);ve(e.tree),be(e.totalFiles)},[]),K=(0,p.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,p.useEffect)(()=>{let e=i(e=>t(!!e.requirements));return n().then(()=>{t(r(`requirements`)),y(!0)}),e},[]),(0,p.useEffect)(()=>{o&&e&&(async()=>{if(!await ue(`requirements`))x(!1);else try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path),x(!0)}catch(e){A(e instanceof Error?e.message:String(e)),x(!0)}})()},[o,e,G]);function Oe(){Se(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function ke(e){F(!1),M(!0),A(null);try{await oe(`requirements`,C,e),await K(C),l(`已新建文件夹「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`新建文件夹失败:${t}`,`error`)}finally{M(!1)}}async function Ae(e){if(e.type===`file`){M(!0),A(null);try{await fe(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function je(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await re(`requirements`,C,t);await K(C),l(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`上传失败:${t}`,`error`)}finally{M(!1),U.current&&(U.current.value=``)}}}function Me(e){let t=te(S,e.path),n=t?.fileCount??0,r=t?de(t):0;L({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function Ne(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await ce(`requirements`,e.path),N&&d(N.path,e.path)&&P(null);let t=d(C,e.path)?ne(e.path):C;await K(t),l(`已删除「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`删除失败:${t}`,`error`)}finally{M(!1)}}}async function Pe(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ie(`requirements`,t.path,e);await K(se(C,t.path,n)),l(`已重命名为「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`重命名失败:${t}`,`error`)}finally{M(!1)}}}let Fe=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Ie(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(t.endsWith(`.md`)||t.endsWith(`.txt`)){M(!0),A(null);try{let t=await le(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!o)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`requirements`)});if(b===null)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!b)return(0,m.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:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`).slice().sort((e,t)=>(t.ctime??t.mtime??0)-(e.ctime??e.mtime??0)),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(we,Q),Le=X.slice(($-1)*V,$*V);function Re(e){W(),Te(e),B(1)}return(0,m.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,m.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(h,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,ye,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:S.map(e=>(0,m.jsx)(v,{node:e,depth:0,activePath:C,expanded:xe,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,m.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,m.jsx)(`span`,{className:`text-stone-400`,children:pe(`requirements`)}),C===`.`?``:C]}),(0,m.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,text/csv,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`,className:`hidden`,onChange:e=>void je(e.target.files)}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),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:`上传文件`})]}),k?(0,m.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,m.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,m.jsx)(h,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,m.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx / .xlsx / .csv)`}):(0,m.jsx)(`ul`,{className:`${De}space-y-1`,children:Le.map(e=>{let t=Ee===e.path;return(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Ie(e)},onDoubleClick:t=>{t.preventDefault(),Ae(e)},children:[(0,m.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`div`,{className:`text-[11px] text-stone-400`,children:[he(e.size),e.ctime||e.mtime?` · ${me(e.ctime??e.mtime)}`:``]})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,m.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,m.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,m.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,m.jsx)(ee,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Re}):null]}),(0,m.jsx)(f,{open:Ce,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void ke(e)}),(0,m.jsx)(f,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Pe(e)}),(0,m.jsx)(s,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Fe,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void Ne()})]})}export{y as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Bg6v8zQQ.js";import{i as r,o as i,s as a}from"./plugins.SqANn3ZB.js";import{t as o}from"./jsx-runtime.DUg_B_vD.js";import{t as s}from"./ConfirmDialog.D5qXeML0.js";import{n as c,t as ee}from"./DocsPager.CnXEnQqa.js";import{showToast as l}from"./Toast.BO2NFckG.js";import{a as te,c as u,d as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,p as le,r as ue,s as d,t as de,u as fe}from"./project-docs.DAw9bzgk.js";import{n as pe}from"./doc-roots.DAJP9Svr.js";import{t as f}from"./NamePromptDialog.Csfnh5eM.js";import{n as me,t as he}from"./docs-format.BlGh-XA_.js";import{t as ge}from"./useListAnim.BoerpmsB.js";var p=e(t(),1),m=o(),_e=5;function h({className:e=`w-4 h-4`,open:t=!1}){return(0,m.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:t?(0,m.jsx)(`path`,{d:`M6 14l1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}):(0,m.jsx)(`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`})})}function g({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z`}),(0,m.jsx)(`path`,{d:`m15 5 4 4`})]})}function _({className:e=`w-3 h-3`}){return(0,m.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M3 6h18`}),(0,m.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),(0,m.jsx)(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}),(0,m.jsx)(`path`,{d:`M10 11v6`}),(0,m.jsx)(`path`,{d:`M14 11v6`})]})}function v({node:e,depth:t,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o}){let s=r[e.path]??i,c=n===e.path;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${c?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8+t*12},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.path),e.children.length&&a(e.path)},"aria-expanded":e.children.length?s:void 0,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${c?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(`span`,{className:`w-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(h,{open:!!(e.children.length&&s),className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,e.fileCount??0,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${s?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:e.children.map(e=>(0,m.jsx)(v,{node:e,depth:t+1,activePath:n,expanded:r,globalOpen:i,onToggle:a,onSelect:o},e.path))})})]})}function y(){let[e,t]=(0,p.useState)(()=>r(`requirements`)),[o,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),[S,ve]=(0,p.useState)([]),[ye,be]=(0,p.useState)(0),[C,w]=(0,p.useState)(`.`),[T,E]=(0,p.useState)([]),[xe,D]=(0,p.useState)({}),[O,Se]=(0,p.useState)(!0),[k,A]=(0,p.useState)(null),[j,M]=(0,p.useState)(!1),[N,P]=(0,p.useState)(null),[Ce,F]=(0,p.useState)(!1),[I,L]=(0,p.useState)(null),[R,z]=(0,p.useState)(null),[we,B]=(0,p.useState)(1),[V,Te]=c(_e),[Ee,H]=(0,p.useState)(null),U=(0,p.useRef)(null),{cls:De,play:W}=ge(),G=(0,p.useCallback)(async()=>{let e=await ae(`requirements`);ve(e.tree),be(e.totalFiles)},[]),K=(0,p.useCallback)(async(e=C)=>{A(null);try{let[t]=await Promise.all([u(`requirements`,e),G()]);E(t.entries),w(t.path)}catch(e){A(e instanceof Error?e.message:String(e))}},[C,G]);(0,p.useEffect)(()=>{let e=i(e=>t(!!e.requirements));return n().then(()=>{t(r(`requirements`)),y(!0)}),e},[]),(0,p.useEffect)(()=>{o&&e&&(async()=>{if(!await ue(`requirements`))x(!1);else try{let[e]=await Promise.all([u(`requirements`,`.`),G()]);E(e.entries),w(e.path),x(!0)}catch(e){A(e instanceof Error?e.message:String(e)),x(!0)}})()},[o,e,G]);function Oe(){Se(e=>!e),D({})}async function q(e){W(),w(e),B(1),P(null),H(null),A(null);try{let t=await u(`requirements`,e);E(t.entries)}catch(e){A(e instanceof Error?e.message:String(e))}}async function ke(e){F(!1),M(!0),A(null);try{await oe(`requirements`,C,e),await K(C),l(`已新建文件夹「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`新建文件夹失败:${t}`,`error`)}finally{M(!1)}}async function Ae(e){if(e.type===`file`){M(!0),A(null);try{await fe(`requirements`,e.path)}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}async function je(e){if(e?.length){M(!0),A(null);try{for(let t of Array.from(e))await re(`requirements`,C,t);await K(C),l(`已上传 ${e.length} 个文件`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`上传失败:${t}`,`error`)}finally{M(!1),U.current&&(U.current.value=``)}}}function Me(e){let t=te(S,e.path),n=t?.fileCount??0,r=t?de(t):0;L({...e,isDir:!0,blocked:n>0||r>0,files:n,dirs:r})}function J(e){L({name:e.name,path:e.path,isDir:!1})}function Y(e,t){z({...e,isDir:t})}async function Ne(){let e=I;if(e&&(L(null),!e.blocked)){M(!0),A(null);try{await ce(`requirements`,e.path),N&&d(N.path,e.path)&&P(null);let t=d(C,e.path)?ne(e.path):C;await K(t),l(`已删除「${e.name}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`删除失败:${t}`,`error`)}finally{M(!1)}}}async function Pe(e){let t=R;if(t&&(z(null),e!==t.name)){M(!0),A(null);try{let n=await ie(`requirements`,t.path,e);await K(se(C,t.path,n)),l(`已重命名为「${e}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),l(`重命名失败:${t}`,`error`)}finally{M(!1)}}}let Fe=(()=>{if(!I)return``;if(!I.isDir)return`删除文件「${I.name}」?将移入系统废纸篓,可随时找回。`;if(I.blocked){let e=[];return I.files&&e.push(`${I.files} 个文件`),I.dirs&&e.push(`${I.dirs} 个子文件夹`),`文件夹「${I.name}」中还有 ${e.join(`、`)},请先清空内部内容后再删除。`}return`删除文件夹「${I.name}」?将移入系统废纸篓。`})();async function Ie(e){if(e.type!==`file`)return;let t=e.name.toLowerCase();if(t.endsWith(`.md`)||t.endsWith(`.txt`)){M(!0),A(null);try{let t=await le(`requirements`,e.path);P({path:t.path,content:t.content})}catch(e){A(e instanceof Error?e.message:String(e))}finally{M(!1)}}}if(!o)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!e)return(0,m.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:a(`requirements`)});if(b===null)return(0,m.jsx)(`div`,{className:`tw-lib-probing`,"aria-busy":`true`,"aria-label":`正在连接本地文档服务`,children:(0,m.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!b)return(0,m.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:`需求文档库需要本地文档服务,当前未就绪。`});let X=T.filter(e=>e.type===`file`).slice().sort((e,t)=>(t.ctime??t.mtime??0)-(e.ctime??e.mtime??0)),Z=T.filter(e=>e.type===`dir`),Q=Math.max(1,Math.ceil(X.length/V)),$=Math.min(we,Q),Le=X.slice(($-1)*V,$*V);function Re(e){W(),Te(e),B(1)}return(0,m.jsxs)(`div`,{className:`flex gap-4 min-h-0`,children:[(0,m.jsxs)(`aside`,{className:`w-56 shrink-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2.5 border-b border-stone-100 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs font-semibold text-stone-500`,children:`文件夹`}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>F(!0),className:`tw-mkdir-btn disabled:opacity-40`,children:`+ 新建`})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto py-2 px-1 space-y-1`,children:[(0,m.jsx)(`div`,{className:`group flex items-center rounded-md ${C===`.`?`bg-[#e8f0fe]`:`hover:bg-stone-100`}`,style:{paddingLeft:8},children:(0,m.jsxs)(`button`,{type:`button`,onClick:()=>{q(`.`),Oe()},"aria-expanded":O,className:`flex-1 min-w-0 flex items-center gap-1.5 py-1.5 pr-1 text-sm text-left ${C===`.`?`text-[#4176e6]`:`text-stone-600`}`,children:[(0,m.jsx)(h,{open:O,className:`w-3.5 h-3.5 shrink-0 text-[#4176e6]`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,children:`全部需求`}),(0,m.jsxs)(`span`,{className:`shrink-0 tabular-nums text-[11px] text-stone-400`,children:[`(`,ye,`)`]})]})}),(0,m.jsx)(`div`,{className:`tw-collapse ${O?`is-open`:``}`,children:(0,m.jsx)(`div`,{className:`tw-collapse-inner space-y-1`,children:S.map(e=>(0,m.jsx)(v,{node:e,depth:0,activePath:C,expanded:xe,globalOpen:O,onToggle:e=>D(t=>({...t,[e]:!(t[e]??O)})),onSelect:e=>void q(e)},e.path))})})]})]}),(0,m.jsxs)(`section`,{className:`flex-1 min-w-0 rounded-xl border border-stone-200 bg-white flex flex-col overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-4 py-3 border-b border-stone-100 flex items-center gap-2 flex-wrap`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-stone-600 flex-1 min-w-0 truncate`,children:[(0,m.jsx)(`span`,{className:`text-stone-400`,children:pe(`requirements`)}),C===`.`?``:C]}),(0,m.jsx)(`input`,{ref:U,type:`file`,multiple:!0,accept:`.md,.txt,.docx,.xlsx,.xls,.csv,text/plain,text/markdown,text/csv,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel`,className:`hidden`,onChange:e=>void je(e.target.files)}),(0,m.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>U.current?.click(),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:`上传文件`})]}),k?(0,m.jsx)(`div`,{className:`mx-4 mt-3 px-3 py-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg`,children:k}):null,(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[Z.length>0&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`子文件夹`}),(0,m.jsx)(`ul`,{className:`space-y-1`,children:Z.map(e=>(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border border-stone-100 hover:bg-stone-50`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 flex items-center gap-2 text-left text-sm text-stone-700`,onClick:()=>void q(e.path),children:[(0,m.jsx)(h,{className:`w-4 h-4 text-[#4176e6] shrink-0`}),(0,m.jsx)(`span`,{className:`flex-1 min-w-0 truncate`,"data-hint":e.name,children:e.name})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!0),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>Me({name:e.name,path:e.path}),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path))})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-xs font-medium text-stone-400 mb-2`,children:`文件`}),X.length===0?(0,m.jsx)(`p`,{className:`text-sm text-stone-400 py-6 text-center border border-dashed border-stone-200 rounded-lg`,children:`当前文件夹为空,点击「上传文件」添加需求文档(.md / .txt / .docx / .xlsx / .csv)`}):(0,m.jsx)(`ul`,{className:`${De}space-y-1`,children:Le.map(e=>{let t=Ee===e.path;return(0,m.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg border transition-colors ${t?`border-[#c7dcff] bg-[#e8f0fe]`:`border-stone-100 hover:bg-stone-50`}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`flex-1 min-w-0 text-left`,onClick:()=>{H(e.path),Ie(e)},onDoubleClick:t=>{t.preventDefault(),Ae(e)},children:[(0,m.jsx)(`div`,{className:`text-sm text-stone-800 truncate`,"data-hint":e.name,children:e.name}),(0,m.jsxs)(`div`,{className:`text-[11px] text-stone-400`,children:[he(e.size),e.ctime||e.mtime?` · ${me(e.ctime??e.mtime)}`:``]})]}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`重命名 ${e.name}`,onClick:()=>Y({name:e.name,path:e.path},!1),className:`p-1.5 rounded text-stone-400 hover:text-[#4176e6] hover:bg-[#e8f0fe] disabled:opacity-40`,children:(0,m.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,m.jsx)(`button`,{type:`button`,disabled:j,"aria-label":`删除 ${e.name}`,onClick:()=>J(e),className:`tw-icon-danger p-1.5 rounded`,children:(0,m.jsx)(_,{className:`w-3.5 h-3.5`})})]},e.path)})})]}),N?(0,m.jsxs)(`div`,{className:`rounded-lg border border-stone-200 overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-3 py-2 bg-stone-50 border-b border-stone-200 flex items-center justify-between`,children:[(0,m.jsx)(`span`,{className:`text-xs text-stone-500 truncate`,children:N.path}),(0,m.jsx)(`button`,{type:`button`,className:`text-xs text-stone-500 hover:text-stone-800`,onClick:()=>P(null),children:`关闭预览`})]}),(0,m.jsx)(`pre`,{className:`max-h-80 overflow-auto p-4 text-xs leading-5 text-stone-700 whitespace-pre-wrap bg-white`,children:N.content})]}):null]}),X.length>0?(0,m.jsx)(ee,{page:$,totalPages:Q,pageSize:V,busy:j,onPage:e=>{W(),B(e)},onPageSize:Re}):null]}),(0,m.jsx)(f,{open:Ce,title:`新建文件夹`,onClose:()=>F(!1),onConfirm:e=>void ke(e)}),(0,m.jsx)(f,{open:R!=null,title:R?.isDir?`重命名文件夹`:`重命名文件`,label:R?.isDir?`文件夹名称`:`文件名称`,initialValue:R?.name??``,lockExtension:R!=null&&!R.isDir,confirmLabel:`保存`,onClose:()=>z(null),onConfirm:e=>void Pe(e)}),(0,m.jsx)(s,{open:I!=null,title:I?.blocked?`无法删除文件夹`:I?.isDir?`删除文件夹`:`删除需求文件`,message:Fe,confirmLabel:I?.blocked?`知道了`:`删除`,cancelLabel:`取消`,danger:!I?.blocked,hideCancel:!!I?.blocked,onClose:()=>L(null),onConfirm:()=>void Ne()})]})}export{y as default};
@@ -1 +1 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as a}from"./app-config.DAIyT--R.js";import{i as te,n as o,r as ne,t as s}from"./listbox.DNxAJmEo.js";import{a as re,o as c}from"./dialog.DZHZCe_T.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ie}from"./ConfirmDialog.D5qXeML0.js";import{showToast as ae}from"./Toast.BO2NFckG.js";import{i as oe}from"./llm.DyweO-KK.js";import{_ as se,c as ce,d as le,f as ue,g as u,i as de,l as fe,n as d,o as f,r as pe,s as me,t as he,u as p,v as ge,y as _e}from"./settings.DbhUT6Ao.js";import{n as m}from"./i18n.ele1lM9e.js";import{s as h}from"./fs-tools.3F9MFrLf.js";import{_ as g,c as _,l as ve}from"./bash-tools.D4DBYc9k.js";import{t as ye}from"./app-version.q6kHEFsx.js";import{n as be,t as xe}from"./update.Fq2CGmCX.js";var v=e(t(),1);function y(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`mcp-client`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var b=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],x=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`mcp-client`,packageName:`@deepseek-ai/dsh-mcp-client`,roleZh:`外接 MCP 真客户端(stdio/HTTP → mcp__*__* 工具)。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],S=l();function C(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function w({status:e}){let t=e.tone===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:e.tone===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`;return(0,S.jsx)(`span`,{className:`shrink-0 rounded border px-1.5 py-0.5 text-[11px] ${t}`,children:e.label})}function Se({tone:e}){return(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e===`ready`?`bg-emerald-500`:e===`warn`?`bg-amber-500`:`bg-stone-300`}`})}function T({open:e}){return(0,S.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-150 ${e?`rotate-90`:``}`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,S.jsx)(`path`,{fillRule:`evenodd`,d:`M7.21 14.77a.75.75 0 01.02-1.06L11.17 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z`,clipRule:`evenodd`})})}var E=`tw.builtin.showPlanned`;function Ce(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,ee]=(0,v.useState)(null),[a,te]=(0,v.useState)(null),[o,ne]=(0,v.useState)(!0),[s,re]=(0,v.useState)(``),[c,l]=(0,v.useState)(()=>{try{return localStorage.getItem(E)===`1`}catch{return!1}}),[ie,ae]=(0,v.useState)({}),[oe,se]=(0,v.useState)({});function ce(e){ae(t=>({...t,[e]:!t[e]}))}function le(e){se(t=>({...t,[e]:!t[e]}))}(0,v.useEffect)(()=>{let e=!0;return(async()=>{try{let[n,i,a,o]=await Promise.all([g(),h(),_(),ve()]);if(!e)return;t(n),r(i),ee(a),te(o)}finally{e&&ne(!1)}})(),()=>{e=!1}},[]);function ue(t){let r=y(t.id);return r===`none`?{label:`规划中`,tone:`plan`}:r===`ready`?{label:`已就绪`,tone:`ready`}:o?{label:`探测中…`,tone:`plan`}:r===`web`?e?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`fs`?n?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`bash`?i?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`pwsh`?a?.ok&&a.available?{label:`已就绪`,tone:`ready`}:a?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}let u=s.trim().toLowerCase(),de=e=>!c&&y(e.id)===`none`&&!u?!1:!u||e.id.toLowerCase().includes(u)||C(e.roleZh).toLowerCase().includes(u),fe=b.filter(e=>y(e.id)===`none`).length+x.filter(e=>y(e.id)===`none`).length,d=b.filter(de),f=x.filter(de),pe=[{id:`session`,title:`会话插件`,hint:`每个会话各自加载,随会话结束释放`,items:d,total:b.length},{id:`global`,title:`全局插件`,hint:`由系统与所有会话共享,常驻运行`,items:f,total:x.length}];return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,S.jsx)(`div`,{className:`shrink-0 px-6 pt-5 pb-3`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`h3`,{className:`text-[15px] font-semibold text-stone-900`,children:`内置插件`}),(0,S.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-stone-500`,children:[`由平台按会话或全局提供,默认常开,不需要开关;状态取决于本机服务是否就绪。`,!c&&fe>0?` 已隐藏 ${fe} 项规划中能力。`:``]})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,S.jsxs)(`label`,{className:`relative block w-44`,children:[(0,S.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,S.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,S.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,S.jsx)(`input`,{value:s,onChange:e=>re(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-8 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-2.5 text-xs text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,S.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-[11px] text-stone-500`,children:[(0,S.jsx)(`input`,{type:`checkbox`,className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/30`,checked:c,onChange:e=>{let t=e.target.checked;l(t);try{localStorage.setItem(E,t?`1`:`0`)}catch{}}}),`显示规划中`]})]})]})}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:(0,S.jsx)(`div`,{className:`space-y-3`,children:pe.map(e=>{let t=!ie[e.id];return(0,S.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>ce(e.id),"aria-expanded":t,className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-stone-50/70`,children:[(0,S.jsx)(T,{open:t}),(0,S.jsx)(`h4`,{className:`text-[13px] font-medium text-stone-700`,children:e.title}),(0,S.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:u?`${e.items.length}/${e.total}`:e.total}),(0,S.jsx)(`span`,{className:`ml-auto truncate text-[11px] text-stone-400`,children:e.hint})]}),t?e.items.length?(0,S.jsx)(`div`,{className:`grid grid-cols-2 items-start gap-2 border-t border-stone-100 p-2.5`,children:e.items.map(t=>{let n=ue(t),r=`${e.id}:${t.id}`,i=!!oe[r];return(0,S.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":i,onClick:()=>le(r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),le(r))},className:`flex cursor-pointer flex-col rounded-lg border p-2.5 text-left transition-colors ${i?`border-[#4176e6]/40 bg-[#f6f9ff]`:`border-stone-200 bg-white hover:border-stone-300 hover:bg-stone-50/60`}`,children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`span`,{className:`mt-1.5`,children:(0,S.jsx)(Se,{tone:n.tone})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`truncate font-mono text-[12.5px] text-stone-800`,children:t.id}),(0,S.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-5 text-stone-500 ${i?``:`line-clamp-2`}`,children:C(t.roleZh)})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1.5`,children:[(0,S.jsx)(w,{status:n}),(0,S.jsx)(T,{open:i})]})]}),i?(0,S.jsxs)(`dl`,{className:`mt-2 grid w-full grid-cols-[auto_1fr] gap-x-2 gap-y-1 border-t border-stone-200/70 pt-2 text-[11px]`,children:[(0,S.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`分类`}),(0,S.jsx)(`dd`,{className:`truncate text-stone-600`,children:t.category}),(0,S.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`npm 包`}),(0,S.jsx)(`dd`,{className:`truncate font-mono text-stone-600`,children:t.packageName||`—`})]}):null]},r)})}):(0,S.jsx)(`p`,{className:`border-t border-stone-100 px-3.5 py-4 text-center text-xs text-stone-400`,children:`没有匹配的内置插件`}):null]},e.id)})})})]})}function we(e){try{return new URL(e).host}catch{return``}}var Te=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],D=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,O=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function Ee({className:e=`w-4 h-4`}){return(0,S.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,S.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function De({className:e=`w-4 h-4`}){return(0,S.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,S.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function Oe({className:e=`w-4 h-4`}){return(0,S.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,S.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,S.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function ke({className:e=`w-4 h-4`}){return(0,S.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M10 4a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v1a2 2 0 0 1-4 0v-1H7a1 1 0 0 1-1-1v-3H5a2 2 0 0 1 0-4h1V6a1 1 0 0 1 1-1h3V4z`})})}function Ae({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,S.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,S.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,S.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,S.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,S.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function k({title:e,description:t,control:n}){return(0,S.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,S.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,S.jsx)(`div`,{className:`shrink-0`,children:n})]})}function A({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,S.jsxs)(ne,{value:e,onChange:n,children:[(0,S.jsx)(te,{className:O,children:(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r})}),(0,S.jsx)(s,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,S.jsxs)(o,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,S.jsx)(`span`,{children:e.label}),(0,S.jsx)(Ee,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function j(){let[e,t]=(0,v.useState)(!1),[l,h]=(0,v.useState)(`general`),[g,_]=(0,v.useState)(()=>ee().model.providers),[ve,y]=(0,v.useState)(()=>ee().model.activeId),[b,x]=(0,v.useState)(null),[C,w]=(0,v.useState)(``),[Se,T]=(0,v.useState)(`DeepSeek`),[E,O]=(0,v.useState)(``),[j,je]=(0,v.useState)(``),[M,N]=(0,v.useState)(``),[P,Me]=(0,v.useState)([]),[F,I]=(0,v.useState)(`idle`),[Ne,Pe]=(0,v.useState)(``),[Fe,Ie]=(0,v.useState)(!0),[Le,Re]=(0,v.useState)(!1),[ze,Be]=(0,v.useState)(!1),[Ve,He]=(0,v.useState)(`readonly`),[Ue,We]=(0,v.useState)(!1),[Ge,L]=(0,v.useState)(!1),[Ke,qe]=(0,v.useState)(null),[R,z]=(0,v.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``,allowPrivateWebFetch:!1}),[Je,Ye]=(0,v.useState)(`14`),Xe=(0,v.useRef)(0),[B,Ze]=(0,v.useState)(null),[Qe,$e]=(0,v.useState)(!1),[et,tt]=(0,v.useState)(!1),[nt,V]=(0,v.useState)(!1),[rt,H]=(0,v.useState)(``),U=(0,v.useRef)(null),it=(0,v.useRef)(!1),W=b!==null,G=R.language,K=g.find(e=>e.id===ve),q=(K?.name||``).trim(),J=B?.status??null,at=J?.phase===`done`&&!!J.to&&J.to===B?.current&&ye!==B?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,ot=J?.phase===`failed`?J.error:``,Y=nt||J?.phase===`installing`||J?.phase===`restarting`,st=(J?.to||B?.latest||``).replace(/^v/,``),X=ot||rt,ct=B?.checkedAt&&!Y?new Date(B.checkedAt).toLocaleTimeString():``,lt=Qe?``:Y?J?.phase===`restarting`?m(`settings.updateRestarting`,void 0,G):m(`settings.updateInstalling`,{v:st},G):X?`${m(`settings.updateFailed`,void 0,G)}:${X}`:at?m(`settings.updateDone`,{v:J?.to||``},G):B?.mode===`dev`&&B?.hasUpdate?m(`settings.updateDevMode`,void 0,G):B?.error?`${m(`settings.updateUnavailable`,void 0,G)}:${B.error}`:B?.hasUpdate?B.mode===`npx`?m(`settings.updateNpxHint`,void 0,G):``:B?`${m(`settings.updateLatest`,void 0,G)}${ct?` · ${m(`settings.updateCheckedAt`,{time:ct},G)}`:``}`:et?m(`settings.updateUnavailable`,void 0,G):``,ut=q||(G===`en`?`No model`:`未配置`),dt=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function ft(e=`general`){h(e),r().then(()=>{pt(),t(!0)})}function pt(){We(n()),_(fe()),y(f()),L(!!p()),z(ce()),pe(ce()),He(me()),x(null)}function Z(){U.current!==null&&(window.clearInterval(U.current),U.current=null)}async function mt(e=!0){$e(!0);try{let t=await xe(e);t&&(Ze(t),H(``))}finally{$e(!1),tt(!0)}}function ht(e){Z();let t=Date.now()+18e4;U.current=window.setInterval(async()=>{if(!it.current){it.current=!0;try{let n=await xe(!0);if(n){Ze(n);let t=n.status;if(t?.phase===`failed`){Z(),V(!1),H(t.error||m(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),V(!1);return}}Date.now()>t&&(Z(),V(!1),H(m(`settings.updateTimeout`,void 0,G)))}finally{it.current=!1}}},1500)}async function gt(){let e=B?.latest||``;H(``),V(!0);let t=B?.current||ye,n=await be(e||void 0);n.ok?ht(t):(V(!1),H(n.error||m(`settings.updateFailed`,void 0,G)))}function _t(e){if(!e){let e=a();x(e),w(`DeepSeek`),T(`DeepSeek`),O(`https://api.deepseek.com/v1`),je(``),N(``),Me([]),I(`idle`),Pe(``),Ie(!0),Re(!1),Be(!1);return}x(e.id),w(e.name),O(e.baseURL);let t=e.apiKey?.trim()||(e.id===f()?i().trim():``)||``;je(t),N(e.model),Me(e.availableModels??[]),I(e.availableModels?.length?`ok`:`idle`),Pe(typeof e.contextWindow==`number`&&e.contextWindow>0?String(e.contextWindow):``),Ie(e.supportsTools!==!1),Re(e.supportsVision===!0),T(d.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),Be(!1)}(0,v.useEffect)(()=>{r().then(()=>pt());let e=e=>{let n=e.detail;h(n?.tab===`model`?`model`:n?.tab===`builtin`?`builtin`:`general`),r().then(()=>{pt(),t(!0)})};window.addEventListener(he,e);let n=ue(e=>z(e)),i=le(e=>He(e));return()=>{window.removeEventListener(he,e),n(),i()}},[]),(0,v.useEffect)(()=>{if(e)return(async()=>{let e=await xe(!1);if(tt(!0),!e)return;Ze(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(V(!0),ht(t.from||e.current))})(),Z},[e]),(0,v.useEffect)(()=>{if(!e||l!==`model`||!W)return;let t=E.trim(),n=j.trim();if(!t||!n){I(e=>e===`ok`?`ok`:`idle`);return}I(`loading`);let r=++Xe.current,i=setTimeout(()=>{oe(t,n).then(e=>{r===Xe.current&&(Me(e),I(`ok`))}).catch(()=>{r===Xe.current&&I(`fail`)})},800);return()=>clearTimeout(i)},[e,l,W,E,j]);function vt(e){T(e);let t=d.find(t=>t.label===e);t&&(t.baseURL&&O(t.baseURL),(!C.trim()||d.some(e=>e.label===C))&&w(t.label)),N(``)}function Q(e){z(se(e))}(0,v.useEffect)(()=>{Ye(String(R.sessionFontSize))},[R.sessionFontSize]);function yt(){let e=Number(Je);if(!Je.trim()||!Number.isFinite(e)){Ye(String(R.sessionFontSize));return}let t=se({sessionFontSize:Math.round(e)});z(t),Ye(String(t.sessionFontSize))}let bt=!!(C.trim()&&E.trim()&&j.trim()&&M.trim()),$=P.length>0;function xt(){if(!bt||!b)return;let e=!g.some(e=>e.id===b),t=Number(Ne.trim()),n=Ne.trim()&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,r=_e({id:b,name:C.trim(),baseURL:E.trim(),apiKey:j.trim(),model:M.trim(),availableModels:$?P:void 0,contextWindow:n,supportsTools:Fe,supportsVision:Le},{activate:!0});_(r),y(b),x(null),L(!!p()),ae(e?`已新增模型服务`:`已保存模型服务`,`success`)}function St(e){qe(e)}function Ct(){let e=Ke;if(!e)return;let t=g.find(t=>t.id===e)?.name??`该服务`;qe(null);let n=de(e);_(n),y(f()),b===e&&x(null),L(!!p()),ae(`已删除模型服务「${t}」`,`success`)}function wt(e){ge(e),y(e),L(!!p())}let Tt=[{value:`readonly`,label:m(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:m(`settings.access.readwrite`,void 0,G)},{value:`full`,label:m(`settings.access.full`,void 0,G)}],Et=[{value:`concise`,label:m(`settings.step.concise`,void 0,G)},{value:`standard`,label:m(`settings.step.standard`,void 0,G)},{value:`detailed`,label:m(`settings.step.detailed`,void 0,G)},{value:`full`,label:m(`settings.step.full`,void 0,G)}],Dt=[{value:`queue`,label:m(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:m(`settings.busySend.interrupt`,void 0,G)}],Ot=[{value:`light`,label:m(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:m(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:m(`settings.appear.system`,void 0,G),icon:`monitor`}],kt=[{id:`general`,label:m(`settings.general`,void 0,G),icon:(0,S.jsx)(De,{})},{id:`model`,label:m(`settings.model`,void 0,G),icon:(0,S.jsx)(Oe,{})},{id:`builtin`,label:m(`settings.builtin`,void 0,G),icon:(0,S.jsx)(ke,{})}],At=l===`general`||l===`builtin`?m(l===`general`?`settings.general`:`settings.builtin`,void 0,G):W?g.some(e=>e.id===b)?m(`settings.editProvider`,void 0,G):m(`settings.addProviderTitle`,void 0,G):m(`settings.model`,void 0,G);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>ft(`general`),className:`tw-nav-settings-btn`,"data-hint":Ge?`设置(已配置模型)`:`设置`,children:[(0,S.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,S.jsx)(`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`})]}),(0,S.jsx)(`span`,{"data-i18n":`nav.settings`,children:m(`nav.settings`,void 0,G)})]}),(0,S.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":dt,onClick:()=>ft(`model`),children:[(0,S.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`tw-nav-provider-name`,children:ut})]})]}),(0,S.jsx)(re,{show:e,children:(0,S.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,S.jsx)(c,{children:(0,S.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,S.jsx)(c,{children:(0,S.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:At}),(0,S.jsx)(`button`,{type:`button`,"aria-label":m(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,S.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,S.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,S.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:kt.map(e=>{let t=l===e.id;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{h(e.id),e.id===`model`&&x(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,S.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,S.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:l===`general`?(0,S.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,S.jsx)(k,{title:m(`settings.access`,void 0,G),description:m(`settings.accessDesc`,void 0,G),control:(0,S.jsx)(A,{value:Ve,options:Tt,onChange:e=>{He(e),u(e)}})}),(0,S.jsx)(k,{title:m(`settings.language`,void 0,G),control:(0,S.jsx)(A,{value:R.language,options:Te,onChange:e=>Q({language:e})})}),(0,S.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:m(`settings.appearance`,void 0,G)}),(0,S.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:Ot.map(e=>{let t=R.appearance===e.value;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,S.jsx)(Ae,{kind:e.icon}),(0,S.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,S.jsx)(k,{title:m(`settings.fontSize`,void 0,G),description:m(`settings.fontSizeDesc`,void 0,G),control:(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,S.jsx)(`input`,{type:`number`,min:12,max:22,value:Je,onChange:e=>Ye(e.target.value),onBlur:yt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,S.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,S.jsx)(k,{title:m(`settings.toolSteps`,void 0,G),description:m(`settings.toolStepsDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.toolStepDetail,options:Et,onChange:e=>Q({toolStepDetail:e})})}),(0,S.jsx)(k,{title:m(`settings.busySend`,void 0,G),description:m(`settings.busySendDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.busySendBehavior,options:Dt,onChange:e=>Q({busySendBehavior:e})})}),(0,S.jsx)(k,{title:m(`settings.allowPrivateWebFetch`,void 0,G),description:m(`settings.allowPrivateWebFetchDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.allowPrivateWebFetch?`on`:`off`,options:[{value:`off`,label:m(`settings.allowPrivateWebFetch.off`,void 0,G)},{value:`on`,label:m(`settings.allowPrivateWebFetch.on`,void 0,G)}],onChange:e=>Q({allowPrivateWebFetch:e===`on`})})}),(0,S.jsx)(k,{title:m(`settings.subagentModel`,void 0,G),description:m(`settings.subagentModelDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.subagentModel?.trim()?R.subagentModel:`inherit`,options:[{value:`inherit`,label:m(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,S.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:m(`settings.platformVersion`,void 0,G)}),(0,S.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,ye]}),B?.hasUpdate&&!Y&&!at?(0,S.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${m(`settings.updateAvailable`,void 0,G)} v${(B.latest||``).replace(/^v/,``)}`}):null]}),(0,S.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),m(`settings.updateWorking`,void 0,G)]}):at?(0,S.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:m(`settings.updateReload`,void 0,G)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,disabled:Qe,onClick:()=>void mt(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:Qe?(0,S.jsxs)(S.Fragment,{children:[m(`settings.updateChecking`,void 0,G),(0,S.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]})]}):m(`settings.updateCheck`,void 0,G)}),B?.hasUpdate?(0,S.jsx)(`button`,{type:`button`,disabled:B.mode===`dev`,onClick:()=>void gt(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:m(`settings.updateNow`,void 0,G)}):null]})})]}),lt?(0,S.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:lt}):null,X&&B?.logPath?(0,S.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:m(`settings.updateLog`,{path:B.logPath},G)}):null]})]}):W?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>x(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:m(`settings.back`,void 0,G)})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.displayName`,void 0,G)}),(0,S.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`DeepSeek`,className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.preset`,void 0,G)}),(0,S.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:d.map(e=>{let t=Se===e.label;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>vt(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,S.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,S.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?we(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.baseUrl`,void 0,G)}),(0,S.jsx)(`input`,{type:`text`,value:E,onChange:e=>O(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.apiKey`,void 0,G)}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`input`,{type:ze?`text`:`password`,value:j,onChange:e=>je(e.target.value),placeholder:`sk-...`,className:`${D} pr-14`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>Be(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:ze?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),Ue?(0,S.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:m(`settings.keyHint`,void 0,G)}):null]}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,S.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:m(`settings.modelField`,void 0,G)}),F===`loading`&&(0,S.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:m(`settings.recognizing`,void 0,G)}),$&&F===`ok`&&(0,S.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:m(`settings.recognized`,{n:P.length},G)}),F===`fail`&&!$&&(0,S.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:m(`settings.recognizeFail`,void 0,G)}),F===`fail`&&$&&(0,S.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:m(`settings.recognizeKeep`,void 0,G)})]}),$?(0,S.jsxs)(ne,{value:M,onChange:N,children:[(0,S.jsx)(te,{className:`${D} flex items-center justify-start text-left hover:border-stone-400 cursor-pointer`,children:(0,S.jsx)(`span`,{className:`min-w-0 truncate text-stone-800`,children:M||(G===`en`?`Select a model`:`请选择模型`)})}),(0,S.jsx)(s,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:P.map(e=>(0,S.jsxs)(o,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e}),(0,S.jsx)(Ee,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,S.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),placeholder:m(`settings.modelPlaceholder`,void 0,G),className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.contextWindow`,void 0,G)}),(0,S.jsx)(`input`,{type:`number`,min:1,value:Ne,onChange:e=>Pe(e.target.value),placeholder:m(`settings.contextWindowPlaceholder`,void 0,G),className:D}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:m(`settings.contextWindowDesc`,void 0,G)})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.supportsTools`,void 0,G)}),(0,S.jsx)(A,{value:Fe?`on`:`off`,options:[{value:`on`,label:m(`settings.cap.on`,void 0,G)},{value:`off`,label:m(`settings.cap.off`,void 0,G)}],onChange:e=>Ie(e===`on`)})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.supportsVision`,void 0,G)}),(0,S.jsx)(A,{value:Le?`on`:`off`,options:[{value:`on`,label:m(`settings.cap.on`,void 0,G)},{value:`off`,label:m(`settings.cap.off`,void 0,G)}],onChange:e=>Re(e===`on`)})]})]})]}),(0,S.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>x(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:m(`settings.cancel`,void 0,G)}),(0,S.jsx)(`button`,{type:`button`,onClick:xt,disabled:!bt,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:m(`settings.save`,void 0,G)})]})]}):l===`builtin`?(0,S.jsx)(Ce,{}):(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,S.jsx)(`p`,{className:`text-sm text-stone-500`,children:m(`settings.modelIntro`,void 0,G)}),(0,S.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[g.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===ve;return(0,S.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,S.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>wt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,S.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>_t(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:m(`settings.edit`,void 0,G)}),g.length>1?(0,S.jsx)(`button`,{type:`button`,onClick:()=>St(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:m(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>_t(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:m(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,S.jsx)(ie,{open:Ke!=null,title:m(`settings.delete`,void 0,G),message:m(`settings.deleteConfirm`,void 0,G),confirmLabel:m(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>qe(null),onConfirm:Ct})]})}export{j as default};
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{a as n,i as r,n as i,r as ee,s as a}from"./app-config.Bg6v8zQQ.js";import{i as te,n as o,r as ne,t as s}from"./listbox.DNxAJmEo.js";import{a as re,o as c}from"./dialog.DZHZCe_T.js";import{t as l}from"./jsx-runtime.DUg_B_vD.js";import{t as ie}from"./ConfirmDialog.D5qXeML0.js";import{showToast as ae}from"./Toast.BO2NFckG.js";import{i as oe}from"./llm.DyweO-KK.js";import{_ as se,c as ce,d as le,f as ue,g as u,i as de,l as fe,n as d,o as f,r as pe,s as me,t as he,u as p,v as ge,y as _e}from"./settings.Cu00if4D.js";import{n as m}from"./i18n.CH6ZNsHf.js";import{s as h}from"./fs-tools.3F9MFrLf.js";import{_ as g,c as _,l as ve}from"./bash-tools.cciCC33C.js";import{t as ye}from"./app-version.C6rzHe1M.js";import{n as be,t as xe}from"./update.Fq2CGmCX.js";var v=e(t(),1);function y(e){return e===`time-context`||e===`tool-todo`||e===`tool-ask-user`||e===`user-questions`||e===`plan-mode`||e===`tool-result-pruner`||e===`compaction-basic`||e===`command-compact`||e===`tool-goal`||e===`command-goal`||e===`goal`||e===`tool-schedule`||e===`schedule`||e===`goal-round-driver`||e===`session-log-download`||e===`llm-retry`||e===`session-title-llm`||e===`session-stats`||e===`locale`||e===`config-editor`||e===`subagent`||e===`subagent-fork-in-process`||e===`spill-local`||e===`spill-policy`||e===`session-turn-outline`||e===`image-offload`||e===`session-persistence-jsonl`||e===`session-checkpoint-policy`||e===`session-query-sqlite`||e===`session-projection-cache`||e===`storage-domain`||e===`workspace-changes`||e===`workspace-dependencies`||e===`skill-office`||e===`fs-observation-policy`||e===`deepseek-llm-api-extensions`||e===`session-log-deepseek`||e===`subagent-model-selection-settings`||e===`authorization`||e===`modules`||e===`resources`||e===`mcp-resources`||e===`mcp-client`||e===`ptc-runtime`||e===`headless-runner`||e===`headless-startup`||e===`sdk-jsonrpc-server`||e===`sdk-app-startup`||e===`acp`||e===`acp-app-startup`||e===`subagent-spawn-in-process`||e===`llm-pi-ai`||e===`session-reference`||e===`tool-subagent`||e===`tool-subagent-control`||e===`tool-subagent-list-agents`||e===`tool-subagent-fork`||e===`tool-workflow`||e===`workflow-ptc`||e===`session-title`||e===`attachment-local`||e===`file-upload`||e===`file-reference-local`||e===`credentials`||e===`connection`||e===`token-meter`||e===`llm`||e===`llm-deepseek`||e===`agent-default-model`||e===`session`||e===`sessions`||e===`session-projection`||e===`storage`||e===`storage-json`||e===`settings`||e===`commands`||e===`shortcuts`||e===`timeout-policy`||e===`shell-env`||e===`approval`||e===`agent`||e===`system-prompt`||e===`tools`||e===`repeat-tool-reminder`?`ready`:e===`tool-web`||e===`web`||e===`web-fetch-http`||e===`web-search-deepseek`?`web`:e===`tool-bash`||e===`tool-jobs`||e===`jobs`||e===`sandbox-policy`||e===`bash-sandbox`||e===`sandbox`||e===`pty`||e===`terminal-bash`||e===`persistent-bash`||e===`subprocess`?`bash`:e===`tool-pwsh`||e===`persistent-pwsh`||e===`terminal-pwsh`||e===`pwsh-sandbox`?`pwsh`:e===`tool-fs`||e===`tool-fs-search`||e===`tool-skill`||e===`skill`||e===`agent-instructions`||e===`present`||e===`office-to-pdf`||e===`filesystem`||e===`fs-sandbox`||e===`permission`||e===`working-directory`||e===`tool-working-directory`||e===`workspace`?`fs`:`none`}var b=[{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`会话能力`},{id:`time-context`,packageName:`@deepseek-ai/dsh-time-context`,roleZh:`注入当前时间与耗时。`,category:`会话能力`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`会话能力`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`会话能力`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`会话能力`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`会话能力`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`会话能力`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载工作区 SKILL.md。`,category:`会话能力`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`会话能力`},{id:`tool-schedule`,packageName:`@deepseek-ai/dsh-tool-schedule`,roleZh:`模型可创建/查询/更新/删除定时提醒,到点投递回原会话。`,category:`会话能力`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`会话能力`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`会话能力`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`planning`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`compaction`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`compaction`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`compaction`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`delegation`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`delegation`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`delegation`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`delegation`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`delegation`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`delegation`},{id:`tool-ask-user`,packageName:`@deepseek-ai/dsh-tool-ask-user`,roleZh:`模型可向用户提出结构化问题并等待回答。`,category:`会话能力`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`会话能力`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`会话能力`},{id:`present`,packageName:`@deepseek-ai/dsh-tool-present`,roleZh:`模型可声明「交付了哪些工作区文件」,便于 UI 展示/打开。`,category:`会话能力`}],x=[{id:`attachment-local`,packageName:`@deepseek-ai/dsh-attachment-local`,roleZh:`本机附件存储与读取。`,category:`会话 / 存储`},{id:`session`,packageName:`@deepseek-ai/dsh-session`,roleZh:`事件溯源的会话存储(会话真相源)。`,category:`会话 / 存储`},{id:`session-checkpoint-policy`,packageName:`@deepseek-ai/dsh-session-checkpoint-policy`,roleZh:`会话检查点策略。`,category:`会话 / 存储`},{id:`session-log-deepseek`,packageName:`@deepseek-ai/dsh-session-log-deepseek`,roleZh:`DeepSeek 侧增量无损会话日志请求扩展。`,category:`会话 / 存储`},{id:`session-log-download`,packageName:`@deepseek-ai/dsh-session-log-export`,roleZh:`导出会话日志。`,category:`会话 / 存储`},{id:`session-persistence-jsonl`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话以 JSONL 持久化。`,category:`会话 / 存储`},{id:`session-projection`,packageName:`@deepseek-ai/dsh-session-projection`,roleZh:`会话投影视图(给 UI/查询用)。`,category:`会话 / 存储`},{id:`session-projection-cache`,packageName:`@deepseek-ai/dsh-session-projection-cache`,roleZh:`会话投影缓存。`,category:`会话 / 存储`},{id:`session-query-sqlite`,packageName:`@deepseek-ai/dsh-session-query-sqlite`,roleZh:`会话全文/结构化查询(sqlite)。`,category:`会话 / 存储`},{id:`session-reference`,packageName:`@deepseek-ai/dsh-session-reference`,roleZh:`会话内引用(消息/文件等)。`,category:`会话 / 存储`},{id:`session-stats`,packageName:`@deepseek-ai/dsh-session-stats`,roleZh:`会话统计信息。`,category:`会话 / 存储`},{id:`session-title`,packageName:`@deepseek-ai/dsh-session-title`,roleZh:`会话标题能力。`,category:`会话 / 存储`},{id:`session-turn-outline`,packageName:`@deepseek-ai/dsh-session-turn-outline`,roleZh:`对话回合摘要。`,category:`会话 / 存储`},{id:`sessions`,packageName:`@deepseek-ai/dsh-session-persistence-jsonl`,roleZh:`会话 JSONL 持久化后端(与 session-persistence 同类)。`,category:`会话 / 存储`},{id:`storage`,packageName:`@deepseek-ai/dsh-storage`,roleZh:`通用存储服务。`,category:`会话 / 存储`},{id:`storage-domain`,packageName:`@deepseek-ai/dsh-storage-domain`,roleZh:`按域划分的存储。`,category:`会话 / 存储`},{id:`storage-json`,packageName:`@deepseek-ai/dsh-storage-json`,roleZh:`JSON 文件存储后端。`,category:`会话 / 存储`},{id:`command-compact`,packageName:`@deepseek-ai/dsh-command-compact`,roleZh:`人类手动压缩会话的 slash 命令。`,category:`模型面工具/命令`},{id:`command-goal`,packageName:`@deepseek-ai/dsh-command-goal`,roleZh:`人类管理会话目标的 slash 命令。`,category:`模型面工具/命令`},{id:`skill-office`,packageName:`@deepseek-ai/dsh-skill-office`,roleZh:`Office(Word/PPT/Excel)相关工作流 Skill。`,category:`模型面工具/命令`},{id:`tool-bash`,packageName:`@deepseek-ai/dsh-tool-bash`,roleZh:`模型可调用 bash 在本机执行命令(可后台、可沙箱升级)。`,category:`模型面工具/命令`},{id:`tool-fs`,packageName:`@deepseek-ai/dsh-tool-fs`,roleZh:`模型可读/写/编辑工作区文件。`,category:`模型面工具/命令`},{id:`tool-fs-search`,packageName:`@deepseek-ai/dsh-tool-fs-search`,roleZh:`模型可用 glob / grep 搜索工作区文件(内置 ripgrep)。`,category:`模型面工具/命令`},{id:`tool-goal`,packageName:`@deepseek-ai/dsh-tool-goal`,roleZh:`模型可读写本会话目标,并在执行时做权限校验。`,category:`模型面工具/命令`},{id:`tool-jobs`,packageName:`@deepseek-ai/dsh-tool-jobs`,roleZh:`模型可查看/读取输出/终止后台任务(job_list/output/kill)。`,category:`模型面工具/命令`},{id:`tool-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh`,roleZh:`模型可调用 PowerShell(主要面向 Windows)。`,category:`模型面工具/命令`},{id:`tool-result-pruner`,packageName:`@deepseek-ai/dsh-compaction-tool-result-pruner`,roleZh:`裁剪过长的工具返回(头/中/尾保留),省 token。`,category:`模型面工具/命令`},{id:`tool-skill`,packageName:`@deepseek-ai/dsh-tool-skill`,roleZh:`模型可按需加载某个 Skill,把技能说明拉进上下文。`,category:`模型面工具/命令`},{id:`tool-subagent`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可派生子代理去执行子任务(spawn)。`,category:`模型面工具/命令`},{id:`tool-subagent-control`,packageName:`@deepseek-ai/dsh-tool-subagent-control`,roleZh:`模型可给子代理发消息、中断、列出正在跑的子代理。`,category:`模型面工具/命令`},{id:`tool-subagent-fork`,packageName:`@deepseek-ai/dsh-tool-subagent`,roleZh:`模型可 fork 当前上下文开子代理并行干活。`,category:`模型面工具/命令`},{id:`tool-subagent-list-agents`,packageName:`@deepseek-ai/dsh-tool-subagent-control/list-agents`,roleZh:`单独暴露 list_agents,列出可用/运行中的子代理。`,category:`模型面工具/命令`},{id:`tool-todo`,packageName:`@deepseek-ai/dsh-tool-todo`,roleZh:`模型可维护本会话待办清单(todo_write)。`,category:`模型面工具/命令`},{id:`tool-web`,packageName:`@deepseek-ai/dsh-tool-web`,roleZh:`模型可网页搜索(web_search)与抓取页面(web_fetch)。`,category:`模型面工具/命令`},{id:`tool-workflow`,packageName:`@deepseek-ai/dsh-tool-workflow`,roleZh:`模型可调用 workflow:跑一段编排脚本来协调多步。`,category:`模型面工具/命令`},{id:`tool-working-directory`,packageName:`@deepseek-ai/dsh-tool-working-directory`,roleZh:`模型可查看/切换会话工作目录。`,category:`模型面工具/命令`},{id:`acp`,packageName:`@deepseek-ai/dsh-acp`,roleZh:`通过 JSON-RPC stdio 驱动 Harness Agent 的自动化协议服务(给外部编排用)。`,category:`其它`},{id:`acp-app-startup`,packageName:`@deepseek-ai/dsh-acp-app`,roleZh:`ACP 配置包启动:在 base 之上挂 JSON-RPC stdio 与进程生命周期。`,category:`其它`},{id:`authorization`,packageName:`@deepseek-ai/dsh-authorization`,roleZh:`授权/鉴权服务。`,category:`其它`},{id:`commands`,packageName:`@deepseek-ai/dsh-commands`,roleZh:`人类 slash 命令注册底座。`,category:`其它`},{id:`config-editor`,packageName:`@deepseek-ai/dsh-config-editor`,roleZh:`配置编辑能力。`,category:`其它`},{id:`connection`,packageName:`@deepseek-ai/dsh-client-connection`,roleZh:`客户端与 Host 连接。`,category:`其它`},{id:`credentials`,packageName:`@deepseek-ai/dsh-credentials-local`,roleZh:`本机凭证存储。`,category:`其它`},{id:`file-reference-local`,packageName:`@deepseek-ai/dsh-file-reference-local`,roleZh:`本机文件引用解析。`,category:`其它`},{id:`file-upload`,packageName:`@deepseek-ai/dsh-client-file-upload`,roleZh:`客户端上传文件。`,category:`其它`},{id:`filesystem`,packageName:`@deepseek-ai/dsh-fs-local`,roleZh:`本机文件系统实现(ctx.fs),供 tool-fs 等读写。`,category:`其它`},{id:`fs-observation-policy`,packageName:`@deepseek-ai/dsh-fs-observation-policy`,roleZh:`文件系统观察/上报策略。`,category:`其它`},{id:`headless-runner`,packageName:`@deepseek-ai/dsh-headless`,roleZh:`无 Host/HTTP/浏览器的一键 Agent/Session 运行器(纯 headless)。`,category:`其它`},{id:`headless-startup`,packageName:`@deepseek-ai/dsh-headless/startup`,roleZh:`Headless 配置包的启动插件。`,category:`其它`},{id:`image-offload`,packageName:`@deepseek-ai/dsh-compaction-image-offload`,roleZh:`超预算图片卸载为占位符并重试。`,category:`其它`},{id:`locale`,packageName:`@deepseek-ai/dsh-client-locale`,roleZh:`界面语言。`,category:`其它`},{id:`mcp-resources`,packageName:`@deepseek-ai/dsh-mcp-resources`,roleZh:`MCP 资源对接。`,category:`其它`},{id:`mcp-client`,packageName:`@deepseek-ai/dsh-mcp-client`,roleZh:`外接 MCP 真客户端(stdio/HTTP → mcp__*__* 工具)。`,category:`其它`},{id:`modules`,packageName:`@deepseek-ai/dsh-client-modules`,roleZh:`客户端模块加载。`,category:`其它`},{id:`office-to-pdf`,packageName:`@deepseek-ai/dsh-office-to-pdf`,roleZh:`Office 转 PDF。`,category:`其它`},{id:`pty`,packageName:`@deepseek-ai/dsh-terminal`,roleZh:`持久 PTY 会话能力缝:会话 id、后端注册、交互读写与信号。`,category:`其它`},{id:`repeat-tool-reminder`,packageName:`@deepseek-ai/dsh-repeat-tool-reminder`,roleZh:`重复工具调用时提醒模型。`,category:`其它`},{id:`resources`,packageName:`@deepseek-ai/dsh-client-resources`,roleZh:`客户端资源。`,category:`其它`},{id:`sdk-app-startup`,packageName:`@deepseek-ai/dsh-sdk-app`,roleZh:`SDK 配置包启动:stdio JSON-RPC 服务与进程生命周期。`,category:`其它`},{id:`sdk-jsonrpc-server`,packageName:`@deepseek-ai/dsh-sdk-jsonrpc-server`,roleZh:`给进程外 SDK 客户端用的 stdio JSON-RPC 服务端。`,category:`其它`},{id:`settings`,packageName:`@deepseek-ai/dsh-settings`,roleZh:`设置读写与校验。`,category:`其它`},{id:`shell-env`,packageName:`@deepseek-ai/dsh-shell-env`,roleZh:`注入/管理 shell 环境变量。`,category:`其它`},{id:`shortcuts`,packageName:`@deepseek-ai/dsh-client-shortcuts`,roleZh:`快捷键注册。`,category:`其它`},{id:`timeout-policy`,packageName:`@deepseek-ai/dsh-tool-call-timeout-policy`,roleZh:`单次工具调用超时策略。`,category:`其它`},{id:`user-questions`,packageName:`@deepseek-ai/dsh-user-questions`,roleZh:`用户提问通道(供 ask_user 等使用)。`,category:`其它`},{id:`working-directory`,packageName:`@deepseek-ai/dsh-working-directory`,roleZh:`会话工作目录状态。`,category:`其它`},{id:`workspace`,packageName:`@deepseek-ai/dsh-workspace`,roleZh:`工作区抽象(根目录、切换等)。`,category:`其它`},{id:`workspace-changes`,packageName:`@deepseek-ai/dsh-workspace-changes`,roleZh:`工作区变更追踪。`,category:`其它`},{id:`workspace-dependencies`,packageName:`@deepseek-ai/dsh-tool-workspace-dependencies`,roleZh:`向模型提供捆绑的 Python/Node/pnpm 依赖绝对路径(load_workspace_dependencies)。`,category:`其它`},{id:`compaction-basic`,packageName:`@deepseek-ai/dsh-compaction-basic`,roleZh:`上下文 token 过高时自动摘要压缩,腾出窗口。`,category:`上下文压缩`},{id:`spill-local`,packageName:`@deepseek-ai/dsh-spill-local`,roleZh:`过大内容溢出到本机文件。`,category:`上下文压缩`},{id:`spill-policy`,packageName:`@deepseek-ai/dsh-spill-policy`,roleZh:`何时溢出、溢出策略。`,category:`上下文压缩`},{id:`token-meter`,packageName:`@deepseek-ai/dsh-token-meter`,roleZh:`统计上下文 token 用量。`,category:`上下文压缩`},{id:`web`,packageName:`@deepseek-ai/dsh-web`,roleZh:`网页能力缝(ctx.web):注册 search/fetch provider。`,category:`网页能力`},{id:`web-fetch-http`,packageName:`@deepseek-ai/dsh-web-fetch-http`,roleZh:`通用 HTTP 抓取网页正文 provider。`,category:`网页能力`},{id:`goal`,packageName:`@deepseek-ai/dsh-goal`,roleZh:`本会话目标状态机服务。`,category:`预设 / 能力服务`},{id:`goal-round-driver`,packageName:`@deepseek-ai/dsh-goal-round-driver`,roleZh:`按目标驱动多轮执行。`,category:`预设 / 能力服务`},{id:`plan-mode`,packageName:`@deepseek-ai/dsh-plan-mode`,roleZh:`计划模式(探查→方案→批准→实施)。`,category:`预设 / 能力服务`},{id:`schedule`,packageName:`@deepseek-ai/dsh-schedule`,roleZh:`主机级持久提醒,到点投递原会话。`,category:`预设 / 能力服务`},{id:`skill`,packageName:`@deepseek-ai/dsh-skill`,roleZh:`Skill 能力注册底座。`,category:`预设 / 能力服务`},{id:`approval`,packageName:`@deepseek-ai/dsh-user-approval`,roleZh:`敏感操作需用户批准。`,category:`执行 / 权限`},{id:`bash-sandbox`,packageName:`@deepseek-ai/dsh-bash-sandbox`,roleZh:`bash 专用沙箱绑定。`,category:`执行 / 权限`},{id:`fs-sandbox`,packageName:`@deepseek-ai/dsh-fs-sandbox`,roleZh:`文件系统沙箱。`,category:`执行 / 权限`},{id:`jobs`,packageName:`@deepseek-ai/dsh-jobs-local`,roleZh:`后台任务注册表(id、归属、轮询、取消)。`,category:`执行 / 权限`},{id:`permission`,packageName:`@deepseek-ai/dsh-permission-presets`,roleZh:`权限预设(只读/读写等档位)。`,category:`执行 / 权限`},{id:`persistent-bash`,packageName:`@deepseek-ai/dsh-tool-bash-persistent`,roleZh:`带 PTY 的持久 Bash 工具(跨调用保持 shell 状态)。`,category:`执行 / 权限`},{id:`persistent-pwsh`,packageName:`@deepseek-ai/dsh-tool-pwsh-persistent`,roleZh:`带 PTY 的持久 PowerShell 工具。`,category:`执行 / 权限`},{id:`pwsh-sandbox`,packageName:`@deepseek-ai/dsh-pwsh-sandbox`,roleZh:`pwsh 专用沙箱绑定。`,category:`执行 / 权限`},{id:`sandbox`,packageName:`@deepseek-ai/dsh-sandbox-local`,roleZh:`本机沙箱执行环境。`,category:`执行 / 权限`},{id:`sandbox-policy`,packageName:`@deepseek-ai/dsh-sandbox-policy`,roleZh:`沙箱策略(能跑什么、不能跑什么)。`,category:`执行 / 权限`},{id:`subprocess`,packageName:`@deepseek-ai/dsh-subprocess-local`,roleZh:`本机子进程执行器。`,category:`执行 / 权限`},{id:`terminal-bash`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 bash PTY 后端。`,category:`执行 / 权限`},{id:`terminal-pwsh`,packageName:`@deepseek-ai/dsh-terminal-bash`,roleZh:`基于子进程终端原语的持久 pwsh PTY 后端。`,category:`执行 / 权限`},{id:`ptc-runtime`,packageName:`@deepseek-ai/dsh-ptc-runtime-node`,roleZh:`PTC(工具调用呈现)Node 运行时。`,category:`子代理 / 工作流`},{id:`subagent`,packageName:`@deepseek-ai/dsh-subagent`,roleZh:`子代理能力底座。`,category:`子代理 / 工作流`},{id:`workflow-ptc`,packageName:`@deepseek-ai/dsh-workflow-ptc`,roleZh:`在沙箱 Node 运行时里跑工作流编排脚本。`,category:`子代理 / 工作流`},{id:`agent`,packageName:`@deepseek-ai/dsh-agent`,roleZh:`Agent 主体:把会话、工具、模型串起来。`,category:`LLM / Agent 核心`},{id:`agent-default-model`,packageName:`@deepseek-ai/dsh-agent-default-model`,roleZh:`解析/提供默认模型配置。`,category:`LLM / Agent 核心`},{id:`agent-instructions`,packageName:`@deepseek-ai/dsh-agent-instructions`,roleZh:`加载 AGENTS.md/CLAUDE.md。`,category:`LLM / Agent 核心`},{id:`deepseek-llm-api-extensions`,packageName:`@deepseek-ai/dsh-deepseek-llm-api-extensions`,roleZh:`给官方 DeepSeek API 适配器登记额外请求字段。`,category:`LLM / Agent 核心`},{id:`llm`,packageName:`@deepseek-ai/dsh-llm`,roleZh:`厂商无关的 LLM 服务接口(发请求、流式、工具调用等)。`,category:`LLM / Agent 核心`},{id:`llm-deepseek`,packageName:`@deepseek-ai/dsh-llm-deepseek-api-key`,roleZh:`DeepSeek API Key 模型适配。`,category:`LLM / Agent 核心`},{id:`llm-pi-ai`,packageName:`@deepseek-ai/dsh-llm-pi-ai`,roleZh:`Pi AI 等 LLM 适配。`,category:`LLM / Agent 核心`},{id:`llm-retry`,packageName:`@deepseek-ai/dsh-llm-retry`,roleZh:`LLM 调用失败重试策略。`,category:`LLM / Agent 核心`},{id:`session-title-llm`,packageName:`@deepseek-ai/dsh-session-title-first-prompt-llm`,roleZh:`用首条用户消息经 LLM 自动起会话标题。`,category:`LLM / Agent 核心`},{id:`subagent-fork-in-process`,packageName:`@deepseek-ai/dsh-subagent-fork-in-process`,roleZh:`进程内 fork 子代理实现。`,category:`LLM / Agent 核心`},{id:`subagent-model-selection-settings`,packageName:`@deepseek-ai/dsh-tool-subagent/model-selection-settings`,roleZh:`子代理可选模型的设置项。`,category:`LLM / Agent 核心`},{id:`subagent-spawn-in-process`,packageName:`@deepseek-ai/dsh-subagent-spawn-in-process`,roleZh:`进程内 spawn 子代理实现。`,category:`LLM / Agent 核心`},{id:`system-prompt`,packageName:`@deepseek-ai/dsh-system-prompt`,roleZh:`系统提示词拼装服务。`,category:`LLM / Agent 核心`},{id:`tools`,packageName:`@deepseek-ai/dsh-tools`,roleZh:`工具注册与执行总闸。`,category:`LLM / Agent 核心`}],S=l();function C(e){return String(e??``).replace(/(\s*dsh[^)]*)/gi,``).replace(/\(\s*dsh[^)]*\)/gi,``).replace(/\bdsh\b/gi,``).replace(/\s{2,}/g,` `).replace(/(\s*)/g,``).trim()}function w({status:e}){let t=e.tone===`ready`?`bg-emerald-50 text-emerald-700 border-emerald-100`:e.tone===`warn`?`bg-amber-50 text-amber-800 border-amber-100`:`bg-stone-100 text-stone-500 border-stone-200`;return(0,S.jsx)(`span`,{className:`shrink-0 rounded border px-1.5 py-0.5 text-[11px] ${t}`,children:e.label})}function Se({tone:e}){return(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e===`ready`?`bg-emerald-500`:e===`warn`?`bg-amber-500`:`bg-stone-300`}`})}function T({open:e}){return(0,S.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-stone-400 transition-transform duration-150 ${e?`rotate-90`:``}`,viewBox:`0 0 20 20`,fill:`currentColor`,children:(0,S.jsx)(`path`,{fillRule:`evenodd`,d:`M7.21 14.77a.75.75 0 01.02-1.06L11.17 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z`,clipRule:`evenodd`})})}var E=`tw.builtin.showPlanned`;function Ce(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,ee]=(0,v.useState)(null),[a,te]=(0,v.useState)(null),[o,ne]=(0,v.useState)(!0),[s,re]=(0,v.useState)(``),[c,l]=(0,v.useState)(()=>{try{return localStorage.getItem(E)===`1`}catch{return!1}}),[ie,ae]=(0,v.useState)({}),[oe,se]=(0,v.useState)({});function ce(e){ae(t=>({...t,[e]:!t[e]}))}function le(e){se(t=>({...t,[e]:!t[e]}))}(0,v.useEffect)(()=>{let e=!0;return(async()=>{try{let[n,i,a,o]=await Promise.all([g(),h(),_(),ve()]);if(!e)return;t(n),r(i),ee(a),te(o)}finally{e&&ne(!1)}})(),()=>{e=!1}},[]);function ue(t){let r=y(t.id);return r===`none`?{label:`规划中`,tone:`plan`}:r===`ready`?{label:`已就绪`,tone:`ready`}:o?{label:`探测中…`,tone:`plan`}:r===`web`?e?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`fs`?n?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`bash`?i?.ok?{label:`已就绪`,tone:`ready`}:{label:`需本地服务`,tone:`warn`}:r===`pwsh`?a?.ok&&a.available?{label:`已就绪`,tone:`ready`}:a?.ok?{label:`未装 PowerShell`,tone:`warn`}:{label:`需本地服务`,tone:`warn`}:{label:`规划中`,tone:`plan`}}let u=s.trim().toLowerCase(),de=e=>!c&&y(e.id)===`none`&&!u?!1:!u||e.id.toLowerCase().includes(u)||C(e.roleZh).toLowerCase().includes(u),fe=b.filter(e=>y(e.id)===`none`).length+x.filter(e=>y(e.id)===`none`).length,d=b.filter(de),f=x.filter(de),pe=[{id:`session`,title:`会话插件`,hint:`每个会话各自加载,随会话结束释放`,items:d,total:b.length},{id:`global`,title:`全局插件`,hint:`由系统与所有会话共享,常驻运行`,items:f,total:x.length}];return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,S.jsx)(`div`,{className:`shrink-0 px-6 pt-5 pb-3`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`h3`,{className:`text-[15px] font-semibold text-stone-900`,children:`内置插件`}),(0,S.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-stone-500`,children:[`由平台按会话或全局提供,默认常开,不需要开关;状态取决于本机服务是否就绪。`,!c&&fe>0?` 已隐藏 ${fe} 项规划中能力。`:``]})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-2`,children:[(0,S.jsxs)(`label`,{className:`relative block w-44`,children:[(0,S.jsxs)(`svg`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-stone-400`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,S.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,S.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),(0,S.jsx)(`input`,{value:s,onChange:e=>re(e.target.value),placeholder:`搜索插件名 / 作用`,className:`h-8 w-full rounded-lg border border-stone-200 bg-white pl-8 pr-2.5 text-xs text-stone-800 outline-none transition-colors placeholder:text-stone-400 focus:border-[#4176e6]`})]}),(0,S.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1.5 text-[11px] text-stone-500`,children:[(0,S.jsx)(`input`,{type:`checkbox`,className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/30`,checked:c,onChange:e=>{let t=e.target.checked;l(t);try{localStorage.setItem(E,t?`1`:`0`)}catch{}}}),`显示规划中`]})]})]})}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 pb-6`,children:(0,S.jsx)(`div`,{className:`space-y-3`,children:pe.map(e=>{let t=!ie[e.id];return(0,S.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>ce(e.id),"aria-expanded":t,className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left transition-colors hover:bg-stone-50/70`,children:[(0,S.jsx)(T,{open:t}),(0,S.jsx)(`h4`,{className:`text-[13px] font-medium text-stone-700`,children:e.title}),(0,S.jsx)(`span`,{className:`text-[11px] tabular-nums text-stone-400`,children:u?`${e.items.length}/${e.total}`:e.total}),(0,S.jsx)(`span`,{className:`ml-auto truncate text-[11px] text-stone-400`,children:e.hint})]}),t?e.items.length?(0,S.jsx)(`div`,{className:`grid grid-cols-2 items-start gap-2 border-t border-stone-100 p-2.5`,children:e.items.map(t=>{let n=ue(t),r=`${e.id}:${t.id}`,i=!!oe[r];return(0,S.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":i,onClick:()=>le(r),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),le(r))},className:`flex cursor-pointer flex-col rounded-lg border p-2.5 text-left transition-colors ${i?`border-[#4176e6]/40 bg-[#f6f9ff]`:`border-stone-200 bg-white hover:border-stone-300 hover:bg-stone-50/60`}`,children:[(0,S.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(`span`,{className:`mt-1.5`,children:(0,S.jsx)(Se,{tone:n.tone})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`truncate font-mono text-[12.5px] text-stone-800`,children:t.id}),(0,S.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-5 text-stone-500 ${i?``:`line-clamp-2`}`,children:C(t.roleZh)})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1.5`,children:[(0,S.jsx)(w,{status:n}),(0,S.jsx)(T,{open:i})]})]}),i?(0,S.jsxs)(`dl`,{className:`mt-2 grid w-full grid-cols-[auto_1fr] gap-x-2 gap-y-1 border-t border-stone-200/70 pt-2 text-[11px]`,children:[(0,S.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`分类`}),(0,S.jsx)(`dd`,{className:`truncate text-stone-600`,children:t.category}),(0,S.jsx)(`dt`,{className:`shrink-0 text-stone-400`,children:`npm 包`}),(0,S.jsx)(`dd`,{className:`truncate font-mono text-stone-600`,children:t.packageName||`—`})]}):null]},r)})}):(0,S.jsx)(`p`,{className:`border-t border-stone-100 px-3.5 py-4 text-center text-xs text-stone-400`,children:`没有匹配的内置插件`}):null]},e.id)})})})]})}function we(e){try{return new URL(e).host}catch{return``}}var Te=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],D=`w-full px-3 py-2 text-sm border border-stone-300 rounded-lg bg-white focus:outline-none focus:ring-2 focus:ring-[#4176e6]/35 focus:border-[#4176e6] transition-colors`,O=`inline-flex items-center gap-1.5 h-9 min-w-30 px-3 rounded-lg bg-stone-100 text-sm text-stone-700 hover:bg-stone-200/80 transition-colors outline-none focus:outline-none`;function Ee({className:e=`w-4 h-4`}){return(0,S.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,S.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function De({className:e=`w-4 h-4`}){return(0,S.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,S.jsx)(`path`,{d:`M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4`})]})}function Oe({className:e=`w-4 h-4`}){return(0,S.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,S.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,S.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function ke({className:e=`w-4 h-4`}){return(0,S.jsx)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M10 4a2 2 0 0 1 4 0v1h3a1 1 0 0 1 1 1v3h1a2 2 0 0 1 0 4h-1v3a1 1 0 0 1-1 1h-3v1a2 2 0 0 1-4 0v-1H7a1 1 0 0 1-1-1v-3H5a2 2 0 0 1 0-4h1V6a1 1 0 0 1 1-1h3V4z`})})}function Ae({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,S.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,S.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}):e===`moon`?(0,S.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,S.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,S.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,S.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function k({title:e,description:t,control:n}){return(0,S.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,S.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,S.jsx)(`div`,{className:`shrink-0`,children:n})]})}function A({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,S.jsxs)(ne,{value:e,onChange:n,children:[(0,S.jsx)(te,{className:O,children:(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r})}),(0,S.jsx)(s,{transition:!0,anchor:{to:`bottom end`,gap:6},className:`tw-select-menu tw-menu-anim z-60 min-w-40 rounded-xl py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:t.map(e=>(0,S.jsxs)(o,{value:e.value,className:`group cursor-pointer select-none flex items-center justify-between gap-3 px-3 py-2 text-sm text-stone-700 data-[focus]:bg-stone-50 data-[selected]:text-stone-900`,children:[(0,S.jsx)(`span`,{children:e.label}),(0,S.jsx)(Ee,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function j(){let[e,t]=(0,v.useState)(!1),[l,h]=(0,v.useState)(`general`),[g,_]=(0,v.useState)(()=>ee().model.providers),[ve,y]=(0,v.useState)(()=>ee().model.activeId),[b,x]=(0,v.useState)(null),[C,w]=(0,v.useState)(``),[Se,T]=(0,v.useState)(`DeepSeek`),[E,O]=(0,v.useState)(``),[j,je]=(0,v.useState)(``),[M,N]=(0,v.useState)(``),[P,Me]=(0,v.useState)([]),[F,I]=(0,v.useState)(`idle`),[Ne,Pe]=(0,v.useState)(``),[Fe,Ie]=(0,v.useState)(!0),[Le,Re]=(0,v.useState)(!1),[ze,Be]=(0,v.useState)(!1),[Ve,He]=(0,v.useState)(`readonly`),[Ue,We]=(0,v.useState)(!1),[Ge,L]=(0,v.useState)(!1),[Ke,qe]=(0,v.useState)(null),[R,z]=(0,v.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``,allowPrivateWebFetch:!1}),[Je,Ye]=(0,v.useState)(`14`),Xe=(0,v.useRef)(0),[B,Ze]=(0,v.useState)(null),[Qe,$e]=(0,v.useState)(!1),[et,tt]=(0,v.useState)(!1),[nt,V]=(0,v.useState)(!1),[rt,H]=(0,v.useState)(``),U=(0,v.useRef)(null),it=(0,v.useRef)(!1),W=b!==null,G=R.language,K=g.find(e=>e.id===ve),q=(K?.name||``).trim(),J=B?.status??null,at=J?.phase===`done`&&!!J.to&&J.to===B?.current&&ye!==B?.current&&Date.now()-Date.parse(J.finishedAt||``)<864e5,ot=J?.phase===`failed`?J.error:``,Y=nt||J?.phase===`installing`||J?.phase===`restarting`,st=(J?.to||B?.latest||``).replace(/^v/,``),X=ot||rt,ct=B?.checkedAt&&!Y?new Date(B.checkedAt).toLocaleTimeString():``,lt=Qe?``:Y?J?.phase===`restarting`?m(`settings.updateRestarting`,void 0,G):m(`settings.updateInstalling`,{v:st},G):X?`${m(`settings.updateFailed`,void 0,G)}:${X}`:at?m(`settings.updateDone`,{v:J?.to||``},G):B?.mode===`dev`&&B?.hasUpdate?m(`settings.updateDevMode`,void 0,G):B?.error?`${m(`settings.updateUnavailable`,void 0,G)}:${B.error}`:B?.hasUpdate?B.mode===`npx`?m(`settings.updateNpxHint`,void 0,G):``:B?`${m(`settings.updateLatest`,void 0,G)}${ct?` · ${m(`settings.updateCheckedAt`,{time:ct},G)}`:``}`:et?m(`settings.updateUnavailable`,void 0,G):``,ut=q||(G===`en`?`No model`:`未配置`),dt=q?K?.model?.trim()?`${q} · ${K.model.trim()}`:q:G===`en`?`No model configured`:`未配置模型`;function ft(e=`general`){h(e),r().then(()=>{pt(),t(!0)})}function pt(){We(n()),_(fe()),y(f()),L(!!p()),z(ce()),pe(ce()),He(me()),x(null)}function Z(){U.current!==null&&(window.clearInterval(U.current),U.current=null)}async function mt(e=!0){$e(!0);try{let t=await xe(e);t&&(Ze(t),H(``))}finally{$e(!1),tt(!0)}}function ht(e){Z();let t=Date.now()+18e4;U.current=window.setInterval(async()=>{if(!it.current){it.current=!0;try{let n=await xe(!0);if(n){Ze(n);let t=n.status;if(t?.phase===`failed`){Z(),V(!1),H(t.error||m(`settings.updateFailed`,void 0,G));return}if(t?.phase===`done`||e&&n.current!==e){Z(),V(!1);return}}Date.now()>t&&(Z(),V(!1),H(m(`settings.updateTimeout`,void 0,G)))}finally{it.current=!1}}},1500)}async function gt(){let e=B?.latest||``;H(``),V(!0);let t=B?.current||ye,n=await be(e||void 0);n.ok?ht(t):(V(!1),H(n.error||m(`settings.updateFailed`,void 0,G)))}function _t(e){if(!e){let e=a();x(e),w(`DeepSeek`),T(`DeepSeek`),O(`https://api.deepseek.com/v1`),je(``),N(``),Me([]),I(`idle`),Pe(``),Ie(!0),Re(!1),Be(!1);return}x(e.id),w(e.name),O(e.baseURL);let t=e.apiKey?.trim()||(e.id===f()?i().trim():``)||``;je(t),N(e.model),Me(e.availableModels??[]),I(e.availableModels?.length?`ok`:`idle`),Pe(typeof e.contextWindow==`number`&&e.contextWindow>0?String(e.contextWindow):``),Ie(e.supportsTools!==!1),Re(e.supportsVision===!0),T(d.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),Be(!1)}(0,v.useEffect)(()=>{r().then(()=>pt());let e=e=>{let n=e.detail;h(n?.tab===`model`?`model`:n?.tab===`builtin`?`builtin`:`general`),r().then(()=>{pt(),t(!0)})};window.addEventListener(he,e);let n=ue(e=>z(e)),i=le(e=>He(e));return()=>{window.removeEventListener(he,e),n(),i()}},[]),(0,v.useEffect)(()=>{if(e)return(async()=>{let e=await xe(!1);if(tt(!0),!e)return;Ze(e);let t=e.status;(t?.phase===`installing`||t?.phase===`restarting`)&&(V(!0),ht(t.from||e.current))})(),Z},[e]),(0,v.useEffect)(()=>{if(!e||l!==`model`||!W)return;let t=E.trim(),n=j.trim();if(!t||!n){I(e=>e===`ok`?`ok`:`idle`);return}I(`loading`);let r=++Xe.current,i=setTimeout(()=>{oe(t,n).then(e=>{r===Xe.current&&(Me(e),I(`ok`))}).catch(()=>{r===Xe.current&&I(`fail`)})},800);return()=>clearTimeout(i)},[e,l,W,E,j]);function vt(e){T(e);let t=d.find(t=>t.label===e);t&&(t.baseURL&&O(t.baseURL),(!C.trim()||d.some(e=>e.label===C))&&w(t.label)),N(``)}function Q(e){z(se(e))}(0,v.useEffect)(()=>{Ye(String(R.sessionFontSize))},[R.sessionFontSize]);function yt(){let e=Number(Je);if(!Je.trim()||!Number.isFinite(e)){Ye(String(R.sessionFontSize));return}let t=se({sessionFontSize:Math.round(e)});z(t),Ye(String(t.sessionFontSize))}let bt=!!(C.trim()&&E.trim()&&j.trim()&&M.trim()),$=P.length>0;function xt(){if(!bt||!b)return;let e=!g.some(e=>e.id===b),t=Number(Ne.trim()),n=Ne.trim()&&Number.isFinite(t)&&t>0?Math.floor(t):void 0,r=_e({id:b,name:C.trim(),baseURL:E.trim(),apiKey:j.trim(),model:M.trim(),availableModels:$?P:void 0,contextWindow:n,supportsTools:Fe,supportsVision:Le},{activate:!0});_(r),y(b),x(null),L(!!p()),ae(e?`已新增模型服务`:`已保存模型服务`,`success`)}function St(e){qe(e)}function Ct(){let e=Ke;if(!e)return;let t=g.find(t=>t.id===e)?.name??`该服务`;qe(null);let n=de(e);_(n),y(f()),b===e&&x(null),L(!!p()),ae(`已删除模型服务「${t}」`,`success`)}function wt(e){ge(e),y(e),L(!!p())}let Tt=[{value:`readonly`,label:m(`settings.access.readonly`,void 0,G)},{value:`readwrite`,label:m(`settings.access.readwrite`,void 0,G)},{value:`full`,label:m(`settings.access.full`,void 0,G)}],Et=[{value:`concise`,label:m(`settings.step.concise`,void 0,G)},{value:`standard`,label:m(`settings.step.standard`,void 0,G)},{value:`detailed`,label:m(`settings.step.detailed`,void 0,G)},{value:`full`,label:m(`settings.step.full`,void 0,G)}],Dt=[{value:`queue`,label:m(`settings.busySend.queue`,void 0,G)},{value:`interrupt`,label:m(`settings.busySend.interrupt`,void 0,G)}],Ot=[{value:`light`,label:m(`settings.appear.light`,void 0,G),icon:`sun`},{value:`dark`,label:m(`settings.appear.dark`,void 0,G),icon:`moon`},{value:`system`,label:m(`settings.appear.system`,void 0,G),icon:`monitor`}],kt=[{id:`general`,label:m(`settings.general`,void 0,G),icon:(0,S.jsx)(De,{})},{id:`model`,label:m(`settings.model`,void 0,G),icon:(0,S.jsx)(Oe,{})},{id:`builtin`,label:m(`settings.builtin`,void 0,G),icon:(0,S.jsx)(ke,{})}],At=l===`general`||l===`builtin`?m(l===`general`?`settings.general`:`settings.builtin`,void 0,G):W?g.some(e=>e.id===b)?m(`settings.editProvider`,void 0,G):m(`settings.addProviderTitle`,void 0,G):m(`settings.model`,void 0,G);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>ft(`general`),className:`tw-nav-settings-btn`,"data-hint":Ge?`设置(已配置模型)`:`设置`,children:[(0,S.jsxs)(`svg`,{className:`tw-nav-ico w-4.5 h-4.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,"aria-hidden":`true`,children:[(0,S.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,S.jsx)(`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`})]}),(0,S.jsx)(`span`,{"data-i18n":`nav.settings`,children:m(`nav.settings`,void 0,G)})]}),(0,S.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${q?``:` is-empty`}`,"data-hint":dt,onClick:()=>ft(`model`),children:[(0,S.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`tw-nav-provider-name`,children:ut})]})]}),(0,S.jsx)(re,{show:e,children:(0,S.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,S.jsx)(c,{children:(0,S.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,S.jsx)(c,{children:(0,S.jsxs)(`div`,{className:`tw-settings-dialog tw-dialog-panel-anim relative bg-white rounded-2xl shadow-2xl w-full max-w-3xl h-[min(92vh,720px)] overflow-hidden flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:At}),(0,S.jsx)(`button`,{type:`button`,"aria-label":m(`settings.close`,void 0,G),onClick:()=>t(!1),className:`w-8 h-8 inline-flex items-center justify-center rounded-lg text-stone-400 hover:text-stone-700 hover:bg-stone-100 transition-colors`,children:(0,S.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,S.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,S.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,S.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:kt.map(e=>{let t=l===e.id;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{h(e.id),e.id===`model`&&x(null)},className:`w-full flex items-center gap-2 px-3 py-2.5 rounded-lg text-sm transition-colors ${t?`bg-[#e8f0fe] text-[#4176e6] font-medium`:`text-stone-600 hover:bg-white/70 hover:text-stone-800`}`,children:[(0,S.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,S.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:l===`general`?(0,S.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,S.jsx)(k,{title:m(`settings.access`,void 0,G),description:m(`settings.accessDesc`,void 0,G),control:(0,S.jsx)(A,{value:Ve,options:Tt,onChange:e=>{He(e),u(e)}})}),(0,S.jsx)(k,{title:m(`settings.language`,void 0,G),control:(0,S.jsx)(A,{value:R.language,options:Te,onChange:e=>Q({language:e})})}),(0,S.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,S.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:m(`settings.appearance`,void 0,G)}),(0,S.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:Ot.map(e=>{let t=R.appearance===e.value;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>Q({appearance:e.value}),className:`flex flex-col items-center justify-center gap-2 h-19 rounded-xl border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] text-[#4176e6] ring-1 ring-[#4176e6]/30`:`border-stone-200 text-stone-500 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,S.jsx)(Ae,{kind:e.icon}),(0,S.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,S.jsx)(k,{title:m(`settings.fontSize`,void 0,G),description:m(`settings.fontSizeDesc`,void 0,G),control:(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,S.jsx)(`input`,{type:`number`,min:12,max:22,value:Je,onChange:e=>Ye(e.target.value),onBlur:yt,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},className:`w-14 h-9 px-2 text-sm text-center rounded-lg bg-stone-100 border-0 outline-none focus:ring-2 focus:ring-[#4176e6]/30`}),(0,S.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,S.jsx)(k,{title:m(`settings.toolSteps`,void 0,G),description:m(`settings.toolStepsDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.toolStepDetail,options:Et,onChange:e=>Q({toolStepDetail:e})})}),(0,S.jsx)(k,{title:m(`settings.busySend`,void 0,G),description:m(`settings.busySendDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.busySendBehavior,options:Dt,onChange:e=>Q({busySendBehavior:e})})}),(0,S.jsx)(k,{title:m(`settings.allowPrivateWebFetch`,void 0,G),description:m(`settings.allowPrivateWebFetchDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.allowPrivateWebFetch?`on`:`off`,options:[{value:`off`,label:m(`settings.allowPrivateWebFetch.off`,void 0,G)},{value:`on`,label:m(`settings.allowPrivateWebFetch.on`,void 0,G)}],onChange:e=>Q({allowPrivateWebFetch:e===`on`})})}),(0,S.jsx)(k,{title:m(`settings.subagentModel`,void 0,G),description:m(`settings.subagentModelDesc`,void 0,G),control:(0,S.jsx)(A,{value:R.subagentModel?.trim()?R.subagentModel:`inherit`,options:[{value:`inherit`,label:m(`settings.subagentModel.inherit`,void 0,G)},...Array.from(new Set([...K?.availableModels??[],...K?.model?[K.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,S.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`text-sm text-stone-700 whitespace-nowrap`,children:m(`settings.platformVersion`,void 0,G)}),(0,S.jsxs)(`span`,{className:`text-sm tabular-nums text-stone-500`,children:[`v`,ye]}),B?.hasUpdate&&!Y&&!at?(0,S.jsx)(`span`,{className:`inline-flex items-center h-[18px] px-1.5 rounded-full bg-[#edf3fe] text-[11px] font-medium text-[#4176e6] tabular-nums whitespace-nowrap`,children:`${m(`settings.updateAvailable`,void 0,G)} v${(B.latest||``).replace(/^v/,``)}`}):null]}),(0,S.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:Y?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 h-8 px-3 rounded-lg text-xs text-stone-500 bg-stone-100 whitespace-nowrap`,children:[(0,S.jsx)(`span`,{className:`w-3 h-3 rounded-full border-2 border-stone-300 border-t-[#4176e6] animate-spin`}),m(`settings.updateWorking`,void 0,G)]}):at?(0,S.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`h-8 px-3 rounded-lg text-xs font-medium text-[#4176e6] bg-[#edf3fe] hover:bg-[#e2ecfd] whitespace-nowrap`,children:m(`settings.updateReload`,void 0,G)}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,disabled:Qe,onClick:()=>void mt(!0),className:`inline-flex items-center justify-center min-w-[76px] h-8 px-3 rounded-lg text-xs font-medium text-stone-600 bg-stone-100 hover:bg-stone-200 disabled:opacity-70 disabled:cursor-default whitespace-nowrap`,children:Qe?(0,S.jsxs)(S.Fragment,{children:[m(`settings.updateChecking`,void 0,G),(0,S.jsxs)(`span`,{className:`tw-dots`,"aria-hidden":`true`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]})]}):m(`settings.updateCheck`,void 0,G)}),B?.hasUpdate?(0,S.jsx)(`button`,{type:`button`,disabled:B.mode===`dev`,onClick:()=>void gt(),className:`h-8 px-3 rounded-lg text-xs font-semibold text-white bg-[#4176e6] hover:bg-[#3566d6] disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap`,children:m(`settings.updateNow`,void 0,G)}):null]})})]}),lt?(0,S.jsx)(`div`,{className:`mt-1 text-[11px] leading-relaxed ${X?`text-red-500`:`text-stone-400`}`,children:lt}):null,X&&B?.logPath?(0,S.jsx)(`div`,{className:`mt-0.5 text-[11px] leading-relaxed text-stone-400 break-all`,children:m(`settings.updateLog`,{path:B.logPath},G)}):null]})]}):W?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,S.jsx)(`button`,{type:`button`,onClick:()=>x(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:m(`settings.back`,void 0,G)})}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.displayName`,void 0,G)}),(0,S.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`DeepSeek`,className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.preset`,void 0,G)}),(0,S.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:d.map(e=>{let t=Se===e.label;return(0,S.jsxs)(`button`,{type:`button`,onClick:()=>vt(e.label),className:`text-left px-3 py-2 rounded-lg border transition-colors ${t?`border-[#4176e6] bg-[#edf3fe] ring-1 ring-[#4176e6]/30`:`border-stone-200 hover:border-stone-300 hover:bg-stone-50`}`,children:[(0,S.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,S.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?we(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.baseUrl`,void 0,G)}),(0,S.jsx)(`input`,{type:`text`,value:E,onChange:e=>O(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.apiKey`,void 0,G)}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`input`,{type:ze?`text`:`password`,value:j,onChange:e=>je(e.target.value),placeholder:`sk-...`,className:`${D} pr-14`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>Be(e=>!e),className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-stone-400 hover:text-stone-600 px-1.5 py-1`,children:ze?G===`en`?`Hide`:`隐藏`:G===`en`?`Show`:`显示`})]}),Ue?(0,S.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:m(`settings.keyHint`,void 0,G)}):null]}),(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,S.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:m(`settings.modelField`,void 0,G)}),F===`loading`&&(0,S.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:m(`settings.recognizing`,void 0,G)}),$&&F===`ok`&&(0,S.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:m(`settings.recognized`,{n:P.length},G)}),F===`fail`&&!$&&(0,S.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:m(`settings.recognizeFail`,void 0,G)}),F===`fail`&&$&&(0,S.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:m(`settings.recognizeKeep`,void 0,G)})]}),$?(0,S.jsxs)(ne,{value:M,onChange:N,children:[(0,S.jsx)(te,{className:`${D} flex items-center justify-start text-left hover:border-stone-400 cursor-pointer`,children:(0,S.jsx)(`span`,{className:`min-w-0 truncate text-stone-800`,children:M||(G===`en`?`Select a model`:`请选择模型`)})}),(0,S.jsx)(s,{transition:!0,anchor:{to:`bottom start`,gap:6},className:`tw-select-menu tw-menu-anim z-60 w-(--button-width) max-h-60 overflow-auto rounded-lg py-1 shadow-lg ring-1 ring-stone-200 focus:outline-none`,children:P.map(e=>(0,S.jsxs)(o,{value:e,className:`group cursor-pointer select-none flex items-center justify-between px-3 py-2 text-sm text-stone-700 data-[focus]:bg-[#edf3fe] data-[selected]:text-[#3565c7] data-[selected]:font-medium`,children:[(0,S.jsx)(`span`,{className:`truncate`,children:e}),(0,S.jsx)(Ee,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,S.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),placeholder:m(`settings.modelPlaceholder`,void 0,G),className:D})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.contextWindow`,void 0,G)}),(0,S.jsx)(`input`,{type:`number`,min:1,value:Ne,onChange:e=>Pe(e.target.value),placeholder:m(`settings.contextWindowPlaceholder`,void 0,G),className:D}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:m(`settings.contextWindowDesc`,void 0,G)})]}),(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.supportsTools`,void 0,G)}),(0,S.jsx)(A,{value:Fe?`on`:`off`,options:[{value:`on`,label:m(`settings.cap.on`,void 0,G)},{value:`off`,label:m(`settings.cap.off`,void 0,G)}],onChange:e=>Ie(e===`on`)})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:m(`settings.supportsVision`,void 0,G)}),(0,S.jsx)(A,{value:Le?`on`:`off`,options:[{value:`on`,label:m(`settings.cap.on`,void 0,G)},{value:`off`,label:m(`settings.cap.off`,void 0,G)}],onChange:e=>Re(e===`on`)})]})]})]}),(0,S.jsxs)(`div`,{className:`shrink-0 px-5 py-3.5 bg-stone-50 border-t border-stone-100 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>x(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:m(`settings.cancel`,void 0,G)}),(0,S.jsx)(`button`,{type:`button`,onClick:xt,disabled:!bt,className:`px-3.5 py-1.5 text-sm font-medium text-white bg-[#4176e6] hover:bg-[#3565c7] rounded-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:m(`settings.save`,void 0,G)})]})]}):l===`builtin`?(0,S.jsx)(Ce,{}):(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,S.jsx)(`p`,{className:`text-sm text-stone-500`,children:m(`settings.modelIntro`,void 0,G)}),(0,S.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[g.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===ve;return(0,S.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-stone-200/90 bg-white px-4 py-3.5 shadow-[0_1px_0_rgba(15,23,42,0.02)]`,children:[(0,S.jsxs)(`button`,{type:`button`,"data-hint":n?G===`en`?`Active`:`当前使用`:G===`en`?`Set active`:`设为当前`,onClick:()=>wt(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,S.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>_t(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:m(`settings.edit`,void 0,G)}),g.length>1?(0,S.jsx)(`button`,{type:`button`,onClick:()=>St(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:m(`settings.delete`,void 0,G)}):null]})]},e.id)}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>_t(null),className:`w-full h-12 rounded-xl border border-dashed border-stone-300 bg-white/60 text-sm text-stone-600 hover:border-[#4176e6] hover:text-[#4176e6] hover:bg-[#edf3fe]/50 transition-colors`,children:m(`settings.addProvider`,void 0,G)})]})]})})]})]})})]})}),(0,S.jsx)(ie,{open:Ke!=null,title:m(`settings.delete`,void 0,G),message:m(`settings.deleteConfirm`,void 0,G),confirmLabel:m(`settings.delete`,void 0,G),cancelLabel:G===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>qe(null),onConfirm:Ct})]})}export{j as default};
@@ -1,4 +1,4 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{E as n,f as r,i}from"./app-config.DAIyT--R.js";import{c as a}from"./plugins.Di6uuouN.js";import{i as o,n as s,r as c,t as l}from"./dialog.DZHZCe_T.js";import{i as ee,n as u,r as d,t as f}from"./menu.Dnrpz489.js";import{t as p}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./ConfirmDialog.D5qXeML0.js";import{showToast as h}from"./Toast.BO2NFckG.js";import{p as te}from"./project-docs.DAw9bzgk.js";import{n as g}from"./llm.DyweO-KK.js";import{t as _}from"./prompts-meta.C_MeYq8G.js";import{u as ne}from"./settings.DbhUT6Ao.js";import{n as v}from"./i18n.ele1lM9e.js";import{a as y,c as re,d as ie,f as b,i as ae,l as oe,m as se,n as ce,o as x,p as le,r as ue,s as de,t as fe,u as pe}from"./spaces-client.OuJPy3GP.js";var S=e(t(),1),me=`你是提示词作者。根据用户对这个数据空间的要求,写一份「默认提示词」正文(Markdown 纯文本,不要用代码围栏)。
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{E as n,f as r,i}from"./app-config.Bg6v8zQQ.js";import{c as a}from"./plugins.SqANn3ZB.js";import{i as o,n as s,r as c,t as l}from"./dialog.DZHZCe_T.js";import{i as ee,n as u,r as d,t as f}from"./menu.Dnrpz489.js";import{t as p}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./ConfirmDialog.D5qXeML0.js";import{showToast as h}from"./Toast.BO2NFckG.js";import{p as te}from"./project-docs.DAw9bzgk.js";import{n as g}from"./llm.DyweO-KK.js";import{t as _}from"./prompts-meta.C_MeYq8G.js";import{u as ne}from"./settings.Cu00if4D.js";import{n as v}from"./i18n.CH6ZNsHf.js";import{a as y,c as re,d as ie,f as b,i as ae,l as oe,m as se,n as ce,o as x,p as le,r as ue,s as de,t as fe,u as pe}from"./spaces-client.Czm-VPh5.js";var S=e(t(),1),me=`你是提示词作者。根据用户对这个数据空间的要求,写一份「默认提示词」正文(Markdown 纯文本,不要用代码围栏)。
2
2
  这份提示词将作为 Lantern Harness 该空间里 AI 助手的默认人设与回答原则。
3
3
  要求:
4
4
  - 用「你是…」起头设定角色;
@@ -0,0 +1 @@
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{t as n}from"./react-dom.DLW9pGCF.js";import{t as r}from"./jsx-runtime.DUg_B_vD.js";var i=e(t(),1),a=e(n(),1),o=r(),s=[{key:`blue`,className:`bg-[#d6e8ff] text-[#245bcc]`},{key:`orange`,className:`bg-[#ffe4c8] text-[#9a5b00]`},{key:`teal`,className:`bg-[#ccf1f0] text-[#0f6b6a]`},{key:`yellow`,className:`bg-[#fff3c4] text-[#7a5c00]`},{key:`green`,className:`bg-[#d3f5dd] text-[#1b6b38]`},{key:`pink`,className:`bg-[#ffd9de] text-[#a12a3a]`},{key:`purple`,className:`bg-[#e6ddff] text-[#5b3bb3]`},{key:`gray`,className:`bg-stone-100 text-stone-600`}];function c(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return s[t%s.length]}function l(e){let t=c(e.label),n=e.hint!==!1&&!e.wrap;return(0,o.jsxs)(`span`,{"data-tag-tone":t.key,className:`tw-tag-pill inline-flex max-w-full min-w-0 items-center gap-1 rounded px-1.5 py-0.5 font-medium ${e.small?`text-[11px]`:`text-xs`} ${e.muted?`bg-stone-100 text-stone-500`:t.className}`,children:[(0,o.jsx)(`span`,{className:e.wrap?`min-w-0 break-words whitespace-normal`:`min-w-0 truncate`,"data-hint":n?e.label:void 0,"data-hint-fit":n?``:void 0,"data-hint-layer":n?e.hintLayer:void 0,children:e.label}),e.onRemove?(0,o.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":`移除 ${e.label}`,onClick:t=>{t.stopPropagation(),e.onRemove?.()},className:`-mr-0.5 flex h-3.5 w-3.5 shrink-0 cursor-pointer items-center justify-center rounded-sm opacity-60 hover:bg-black/10 hover:opacity-100`,children:`×`}):null]})}var u=(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M12 20h9`}),(0,o.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),d=(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M3 6h18`}),(0,o.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,o.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,o.jsx)(`path`,{d:`M10 11v6M14 11v6`})]});function f(e){let{options:t,selected:n,creatable:r,query:a}=e,s=a.trim(),[c,f]=(0,i.useState)(null),[p,m]=(0,i.useState)(``),h=!!(e.onRenameOption||e.onDeleteOption),g=(0,i.useMemo)(()=>{let e=s.toLowerCase();return e?t.filter(t=>t.toLowerCase().includes(e)):[...t]},[t,s]),_=r&&s.length>0&&!t.includes(s);function v(e){f(e),m(e)}function y(t){let n=p.trim();f(null),n&&n!==t&&e.onRenameOption?.(t,n)}return(0,o.jsxs)(`div`,{className:`flex max-h-72 flex-col`,children:[(0,o.jsx)(`div`,{className:`p-1 pb-0`,children:(0,o.jsx)(`input`,{autoFocus:!0,value:a,onChange:t=>e.onQuery(t.target.value),onKeyDown:t=>{if(t.key===`Escape`){t.preventDefault(),t.stopPropagation(),e.onQuery(``),e.onClear();return}if(t.key!==`Enter`)return;if(t.preventDefault(),_){e.onPick(s);return}let n=g[0];n&&e.onPick(n)},placeholder:`查找或创建选项`,className:`h-8 w-full rounded-md border border-stone-200 bg-white px-2 text-sm text-stone-800 outline-none placeholder:text-stone-400 focus:border-[#3370ff]`})}),(0,o.jsxs)(`div`,{className:`mt-1 min-h-0 flex-1 space-y-1 overflow-auto p-1`,children:[_?(0,o.jsxs)(`button`,{type:`button`,onClick:()=>e.onPick(s),className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-stone-500 hover:bg-stone-50`,children:[(0,o.jsx)(`span`,{className:`text-stone-400`,children:`+`}),(0,o.jsxs)(`span`,{className:`truncate`,children:[`创建「`,s,`」`]})]}):null,g.map(t=>{if(c===t)return(0,o.jsx)(`div`,{className:`px-1 py-0.5`,children:(0,o.jsx)(`input`,{autoFocus:!0,"aria-label":`重命名 ${t}`,value:p,onChange:e=>m(e.target.value),onBlur:()=>f(null),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),y(t)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(null))},className:`h-8 w-full rounded-md border border-[#3370ff] px-2 text-sm text-stone-800 outline-none`})},t);let r=n.includes(t);return(0,o.jsxs)(`div`,{className:`group/opt flex items-center gap-1 rounded-md pr-1 ${r?`bg-[#dce8ff] hover:bg-[#d4e3ff]`:`hover:bg-stone-100`}`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:()=>e.onPick(t),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left`,children:(0,o.jsx)(l,{label:t,hintLayer:`popover`,small:!0})}),h?(0,o.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/opt:opacity-100 focus-within:opacity-100`,children:[e.onRenameOption?(0,o.jsx)(`button`,{type:`button`,"aria-label":`重命名 ${t}`,onClick:()=>v(t),className:`flex h-6 w-6 items-center justify-center rounded text-stone-400 hover:bg-stone-200/70 hover:text-stone-700`,children:u}):null,e.onDeleteOption?(0,o.jsx)(`button`,{type:`button`,"aria-label":`删除 ${t}`,onClick:()=>e.onDeleteOption?.(t),className:`flex h-6 w-6 items-center justify-center rounded text-red-500 hover:bg-red-100 hover:text-red-600`,children:d}):null]}):null]},t)}),g.length===0&&!_?(0,o.jsx)(`div`,{className:`px-2 py-2 text-sm text-stone-400`,children:`无匹配项`}):null]})]})}function p(){let e=(0,i.useRef)(null),t=(0,i.useRef)(null),[n,r]=(0,i.useState)(!1),[a,o]=(0,i.useState)(``),[s,c]=(0,i.useState)({left:0,top:0,width:220,openUp:!1});(0,i.useEffect)(()=>{if(!n)return;let i=n=>{let i=n.target;e.current?.contains(i)||t.current?.contains(i)||(r(!1),o(``))},a=e=>{e.target instanceof Node&&t.current?.contains(e.target)||(r(!1),o(``))},s=()=>r(!1);return document.addEventListener(`mousedown`,i,!0),window.addEventListener(`scroll`,a,!0),window.addEventListener(`resize`,s),()=>{document.removeEventListener(`mousedown`,i,!0),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,s)}},[n]);function l(){if(n){r(!1),o(``);return}let t=e.current;if(!t)return;let i=t.getBoundingClientRect(),a=Math.max(i.width,240),s=Math.min(i.left,Math.max(8,window.innerWidth-a-8)),l=i.bottom+4,u=l+280>window.innerHeight&&i.top>280;c({left:s,top:u?i.top-4:l,width:a,openUp:u}),o(``),r(!0)}return{triggerRef:e,panelRef:t,open:n,setOpen:r,query:a,setQuery:o,anchor:s,toggle:l}}function m(e){return(0,o.jsx)(`div`,{role:`button`,tabIndex:0,"aria-label":e.ariaLabel,"aria-expanded":e.open,onClick:e.onClick,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.onClick())},className:`flex w-full cursor-pointer items-center gap-1 rounded-md border border-transparent text-sm transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:outline-none ${e.compact?`min-h-8 px-1.5 py-1`:`min-h-9 px-2 py-1`}`,children:e.children})}function h(e){let t=p(),{value:n,onChange:r}=e;function i(e){r(e),t.setOpen(!1),t.setQuery(``)}let s=t.open&&typeof document<`u`?(0,a.createPortal)((0,o.jsxs)(`div`,{ref:t.panelRef,className:`tw-select-menu tw-popover-anim fixed z-[1000] rounded-lg p-1 shadow-lg ring-1 ring-stone-200`,style:{left:t.anchor.left,width:t.anchor.width,...t.anchor.openUp?{bottom:window.innerHeight-t.anchor.top}:{top:t.anchor.top}},children:[(0,o.jsx)(f,{options:e.options,selected:n?[n]:[],creatable:e.creatable!==!1,query:t.query,onQuery:t.setQuery,onPick:i,onClear:()=>t.setOpen(!1),onRenameOption:e.onRenameOption,onDeleteOption:e.onDeleteOption}),n?(0,o.jsx)(`button`,{type:`button`,onClick:()=>i(``),className:`mt-1 w-full rounded-md border-t border-stone-100 px-2 py-1.5 text-center text-xs text-stone-400 hover:bg-stone-50 hover:text-stone-600`,children:`清除选择`}):null]}),document.body):null;return(0,o.jsxs)(`div`,{ref:t.triggerRef,className:e.className,children:[(0,o.jsx)(m,{ariaLabel:e.ariaLabel,compact:e.compact,open:t.open,onClick:()=>{e.disabled||t.toggle()},children:(0,o.jsx)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:n?(0,o.jsx)(l,{label:n,onRemove:()=>{r(``)}}):(0,o.jsx)(`span`,{className:`truncate text-stone-300`,children:e.placeholder??`查找或创建选项`})})}),s]})}export{h as t};
@@ -0,0 +1 @@
1
+ import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.Bg6v8zQQ.js";import{i as r,o as i,s as ee}from"./plugins.SqANn3ZB.js";import{n as a,o,r as s,s as c}from"./view-prefs.SdItxolG.js";import{i as l,n as u,r as d,t as f}from"./dialog.DZHZCe_T.js";import{t as p}from"./jsx-runtime.DUg_B_vD.js";import{t as m}from"./ConfirmDialog.D5qXeML0.js";import{t as h}from"./DatePicker.Bkl71M49.js";import{t as g}from"./SelectDropdown.apWlFGbA.js";import{showToast as _}from"./Toast.BO2NFckG.js";import{c as v,d as y,i as b,l as x,n as S,o as te,t as C}from"./ColumnResize.BgYkV9Iy.js";import{C as w,F as ne,O as re,a as T,b as E,c as ie,f as ae,g as oe,h as se,i as D,j as O,m as k,n as A,o as ce,p as le,r as j,s as ue,t as M,u as de}from"./tasks.jfnSAEmg.js";import{a as N,l as P,n as F,o as I,r as L,s as R,t as z}from"./DrawerField.C0MkN-LW.js";var B=e(t(),1),V=p(),fe=8e3,H=[{key:`title`,width:280,min:200},{key:`status`,width:104,min:80},{key:`priority`,width:104,min:88},{key:`start`,width:108,min:88},{key:`due`,width:108,min:88},{key:`cycle`,width:76,min:60},{key:`todos`,width:84,min:68},{key:`progress`,width:132,min:104},{key:`note`,width:140,min:88},{key:`filler`,filler:!0},{key:`action`,width:76,min:64}],pe={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,closed:`bg-stone-100 text-stone-400`,cancelled:`bg-stone-100 text-stone-400 line-through`},me={urgent_important:`bg-[#f54a45] text-white`,important:`bg-[#ff8800] text-white`,urgent:`bg-[#f7ba1e] text-stone-800`,normal:`bg-stone-200 text-stone-600`,"":`bg-transparent text-stone-400`},U={pending:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,cancelled:`bg-stone-100 text-stone-400`,overdue:`bg-[#fee4e3] text-[#c02a26]`},he={pool:`bg-stone-400`,in_progress:`bg-[#3370ff]`,done:`bg-[#34c724]`,closed:`bg-stone-300`,cancelled:`bg-stone-300`},ge={urgent_important:`bg-[#f54a45]`,important:`bg-[#ff8800]`,urgent:`bg-[#f7ba1e]`,normal:`bg-stone-300`,"":`border border-stone-300 bg-transparent`},_e=j.map(e=>({value:e,label:D[e]})),ve=[{value:``,label:`未设置`},...M.map(e=>({value:e,label:A[e]}))],ye=[{value:`all`,label:`全部优先级`},...M.map(e=>({value:e,label:A[e]}))],be=[{value:`all`,label:`全部`},{value:`pool`,label:`任务池`},{value:`in_progress`,label:`进行中`},{value:`done`,label:`已完成`},{value:`closed`,label:`已关闭`},{value:`cancelled`,label:`已取消`}],xe=[`all`,`pool`,`in_progress`,`done`,`closed`,`cancelled`],Se=`tasks.status-tab`,Ce=`tasks.priority-filter`,we=`tasks.search`,Te=ye.map(e=>e.value);function W(e){return(0,V.jsxs)(`div`,{"data-tone":e.tone,className:`tw-stat-card flex min-w-0 flex-col gap-1 rounded-xl border px-4 py-3 ${e.tone===`urgent`?`border-red-100 bg-red-50/60`:`border-stone-200 bg-white`}`,children:[(0,V.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums ${e.tone===`urgent`?`text-[#c02a26]`:`text-stone-900`}`,children:e.value}),(0,V.jsx)(`span`,{className:`truncate text-xs text-stone-500`,children:e.label})]})}function Ee(e){let{open:t,task:n,todos:r,onClose:i,onSaved:ee}=e,[a,o]=(0,B.useState)({title:``}),[s,c]=(0,B.useState)(``),[p,m]=(0,B.useState)(!1);(0,B.useEffect)(()=>{t&&(c(``),m(!1),o(n?{title:n.title,status:n.status,priority:n.priority,startDate:n.startDate,dueDate:n.dueDate,note:n.note}:{title:``,status:`pool`,priority:``,startDate:O(),dueDate:O()}))},[t,n]);function g(e){o(t=>({...t,...e}))}let v=k({startDate:a.startDate??``,dueDate:a.dueDate??``}),y=n?r.filter(e=>e.taskId===n.id):[],b=y.filter(e=>e.status===`done`).length,x=y.length?Math.round(b/y.length*100):0;async function S(){let e=(a.title??``).trim();if(!e)c(`请填写任务名称`);else if(a.startDate&&a.dueDate&&a.dueDate<a.startDate)c(`截止日期不能早于开始日期`);else{m(!0),c(``);try{n?await oe(n.id,a):await T([{...a,title:e}],{mode:`manual`}),await ee(),_(n?`已保存任务`:`已新建任务`,`success`),i()}catch(e){let t=e instanceof Error?e.message:String(e);c(t),_(`保存任务失败:${t}`,`error`)}finally{m(!1)}}}return(0,V.jsxs)(d,{open:t,onClose:i,transition:!0,className:`relative z-100`,children:[(0,V.jsx)(f,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/25`,"aria-hidden":`true`}),(0,V.jsx)(`div`,{className:`fixed inset-0 flex justify-end`,children:(0,V.jsxs)(l,{transition:!0,className:`tw-drawer-panel-anim flex h-full w-full max-w-[520px] flex-col border-l border-stone-200 bg-white shadow-2xl`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-stone-100 px-6 py-4`,children:[(0,V.jsx)(u,{className:`text-base font-semibold text-stone-900`,children:n?`任务详情`:`新建任务`}),(0,V.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`关闭`,className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`✕`})]}),(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-3`,children:[(0,V.jsx)(F,{icon:(0,V.jsx)(P,{}),label:`任务名称`,children:(0,V.jsx)(`input`,{autoFocus:!0,value:a.title,onChange:e=>g({title:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S())},placeholder:`请输入内容`,className:z})}),(0,V.jsx)(F,{icon:(0,V.jsx)(R,{}),label:`任务状态`,children:(0,V.jsx)(L,{ariaLabel:`任务状态`,menuMinWidth:140,options:_e,value:a.status??`pool`,onChange:e=>g({status:e}),label:D[a.status??`pool`],optionDotClassName:e=>he[e]})}),(0,V.jsx)(F,{icon:(0,V.jsx)(R,{}),label:`紧急程度`,children:(0,V.jsx)(L,{ariaLabel:`紧急程度`,menuMinWidth:140,options:ve,value:a.priority??``,onChange:e=>g({priority:e}),label:a.priority?A[a.priority]:`未设置`,optionDotClassName:e=>ge[e]})}),(0,V.jsx)(F,{icon:(0,V.jsx)(N,{}),label:`开始日期`,children:(0,V.jsx)(h,{value:a.startDate??``,onChange:e=>g({startDate:e}),className:`${z} tabular-nums`})}),(0,V.jsx)(F,{icon:(0,V.jsx)(N,{}),label:`截止日期`,children:(0,V.jsx)(h,{value:a.dueDate??``,onChange:e=>g({dueDate:e}),className:`${z} tabular-nums`})}),(0,V.jsx)(F,{icon:(0,V.jsx)(I,{}),label:`任务周期`,children:(0,V.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:v===null?`—`:`${v} 天`})}),(0,V.jsx)(F,{icon:(0,V.jsx)(I,{}),label:`待办进度`,children:(0,V.jsx)(`div`,{className:`px-2 pt-1.5 text-sm text-stone-500`,children:y.length?`${b}/${y.length} · ${x}%`:`还没有关联待办`})}),(0,V.jsx)(F,{icon:(0,V.jsx)(P,{}),label:`备注`,children:(0,V.jsx)(`textarea`,{value:a.note??``,onChange:e=>g({note:e.target.value}),rows:4,placeholder:`请输入内容`,className:`w-full resize-y rounded-md border border-transparent bg-transparent px-2 py-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-400`})}),n&&y.length?(0,V.jsxs)(`div`,{className:`mx-6 mt-2 rounded-lg border border-stone-100 bg-stone-50/60 px-3 py-2`,children:[(0,V.jsx)(`div`,{className:`mb-1.5 text-xs font-medium text-stone-500`,children:`关联待办`}),(0,V.jsx)(`ul`,{className:`space-y-1.5`,children:y.map(e=>{let t=w(e,O());return(0,V.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-stone-700`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,V.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${U[t]}`,children:E[t]})]},e.id)})})]}):null,s?(0,V.jsx)(`div`,{className:`mx-6 mt-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:s}):null]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-stone-100 px-6 py-3`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:i,disabled:p,className:`h-8 rounded-lg border border-stone-200 px-4 text-sm text-stone-600 transition-colors hover:bg-stone-100 disabled:opacity-40`,children:`取消`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void S(),disabled:p,className:`h-8 rounded-lg bg-[#3370ff] px-4 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:p?`保存中…`:n?`保存`:`新建`})]})]})})]})}function De(){let[e,t]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!0),[d,f]=(0,B.useState)(!0),[p,w]=(0,B.useState)(null),[T,E]=(0,B.useState)([]),[O,j]=(0,B.useState)([]),[M,N]=(0,B.useState)(null),[P,F]=(0,B.useState)(!1),[I,L]=(0,B.useState)(()=>s(we)),[R,z]=(0,B.useState)(()=>a(Se,xe,`all`)),[U,De]=(0,B.useState)(()=>a(Ce,Te,`all`)),[Oe,G]=(0,B.useState)(null),[K,q]=(0,B.useState)(null);function ke(e){o(Se,e),z(e)}function Ae(e){c(we,e),L(e)}function je(e){o(Ce,e),De(e)}let J=(0,B.useRef)(!0),Y=x(`lh:tasks:cols:v1`,H),Me=y(`tasks`);(0,B.useEffect)(()=>(J.current=!0,()=>{J.current=!1}),[]);let X=(0,B.useCallback)(async()=>{try{let[e,t]=await Promise.all([de(),d?re().catch(()=>[]):Promise.resolve([])]);if(!J.current)return;E(e),j(t),N(null)}catch(e){if(!J.current)return;N(e instanceof Error?e.message:String(e))}},[d]);(0,B.useEffect)(()=>{let e=i(e=>{u(!!e.tasks),f(!!e.todos)});return n().then(()=>{u(r(`tasks`)),f(r(`todos`)),t(!0)}),e},[]),(0,B.useEffect)(()=>{e&&l&&(async()=>{let e=await ue();J.current&&(e?(await X(),J.current&&w(!0)):w(!1))})()},[e,l,X]),(0,B.useEffect)(()=>{if(p!==!0)return;let e=window.setInterval(()=>void X(),fe),t=()=>void X();return window.addEventListener(`focus`,t),()=>{window.clearInterval(e),window.removeEventListener(`focus`,t)}},[p,X]);let Ne=(0,B.useMemo)(()=>se(O),[O]),Z=(0,B.useMemo)(()=>le(T),[T]),Pe=(0,B.useMemo)(()=>ie(T,{status:R,priority:U,keyword:I}),[T,R,U,I]),Q=(0,B.useMemo)(()=>ae(Pe),[Pe]);async function $(e,t){E(n=>n.map(n=>n.id===e?{...n,...t}:n));try{let n=await oe(e,t);if(!J.current)return;E(t=>t.map(t=>t.id===e?n:t)),N(null)}catch(e){N(e instanceof Error?e.message:String(e)),await X()}}async function Fe(){let e=K;if(e){q(null),F(!0);try{await ce([e.id]),await Promise.all(O.filter(t=>t.taskId===e.id).map(e=>ne(e.id,{taskId:``,linkedTask:``}).catch(()=>null))),await X(),_(`已删除任务「${e.title}」`,`success`)}catch(e){let t=e instanceof Error?e.message:String(e);N(t),_(`删除任务失败:${t}`,`error`)}finally{J.current&&F(!1)}}}return e?l?p===null?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在连接任务服务`,children:(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,V.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})}):p?(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-7`,children:[(0,V.jsx)(W,{label:`全部任务`,value:Z.total}),(0,V.jsx)(W,{label:`任务池`,value:Z.pool}),(0,V.jsx)(W,{label:`进行中`,value:Z.in_progress}),(0,V.jsx)(W,{label:`已完成`,value:Z.done}),(0,V.jsx)(W,{label:`已关闭`,value:Z.closed}),(0,V.jsx)(W,{label:`已取消`,value:Z.cancelled}),(0,V.jsx)(W,{label:`需要紧急`,value:Z.urgent,tone:`urgent`})]}),(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stone-100 px-4 py-3`,children:[(0,V.jsx)(`input`,{value:I,onChange:e=>Ae(e.target.value),placeholder:`搜索任务…`,className:`h-9 w-52 rounded-lg border border-stone-200 px-3 text-sm text-stone-800 outline-none focus:border-[#3370ff]`}),(0,V.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:be.map(e=>(0,V.jsx)(`button`,{type:`button`,onClick:()=>ke(e.value),className:`h-8 rounded-md px-3 text-sm transition-colors ${R===e.value?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:e.label},e.value))}),(0,V.jsx)(g,{flat:!0,className:`w-[136px]`,ariaLabel:`优先级筛选`,options:ye,value:U,onChange:e=>je(e)}),(0,V.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>void X(),"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,V.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,V.jsx)(`button`,{type:`button`,disabled:P,onClick:()=>G({task:null}),className:`h-9 shrink-0 rounded-lg bg-[#3370ff] px-3 text-sm font-medium whitespace-nowrap text-white transition-colors hover:bg-[#2b5fd9] disabled:opacity-40`,children:`+ 新建任务`})]})]}),M?(0,V.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1`,children:M}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>N(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,V.jsx)(`div`,{ref:Me,className:`tw-scroll-x min-h-0 flex-1 overflow-auto`,children:(0,V.jsxs)(`table`,{className:`tw-task-table tw-sticky-table w-full table-fixed text-sm`,style:Y.tableStyle,children:[(0,V.jsx)(`colgroup`,{children:H.map(e=>(0,V.jsx)(`col`,{style:Y.widthOf(e.key)?{width:Y.widthOf(e.key)}:void 0},e.key))}),(0,V.jsx)(`thead`,{className:`tw-table-head sticky top-0 z-10 text-xs text-stone-500`,children:(0,V.jsxs)(`tr`,{children:[(0,V.jsxs)(`th`,{className:te,children:[`任务描述`,(0,V.jsx)(C,{...Y.resizeProps(`title`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`任务状态`,(0,V.jsx)(C,{...Y.resizeProps(`status`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`紧急程度`,(0,V.jsx)(C,{...Y.resizeProps(`priority`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`开始日期`,(0,V.jsx)(C,{...Y.resizeProps(`start`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`截止日期`,(0,V.jsx)(C,{...Y.resizeProps(`due`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`任务周期`,(0,V.jsx)(C,{...Y.resizeProps(`cycle`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`待办数量`,(0,V.jsx)(C,{...Y.resizeProps(`todos`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`完成进度`,(0,V.jsx)(C,{...Y.resizeProps(`progress`)})]}),(0,V.jsxs)(`th`,{className:`relative px-2 py-2 text-left font-medium whitespace-nowrap`,children:[`备注`,(0,V.jsx)(C,{...Y.resizeProps(`note`)})]}),(0,V.jsx)(`th`,{"aria-hidden":`true`}),(0,V.jsx)(`th`,{className:v,children:`操作`})]})}),(0,V.jsxs)(`tbody`,{children:[Q.map(e=>{let t=k(e),n=Ne[e.id]??{total:0,done:0,percent:0};return(0,V.jsxs)(`tr`,{className:`group/row hover:bg-[#f7f8fa]`,children:[(0,V.jsx)(`td`,{className:S,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.source===`ai`?(0,V.jsx)(`span`,{className:`shrink-0 rounded bg-[#e1eaff] px-1 py-px text-[10px] text-[#1f4ec2]`,children:`AI`}):null,(0,V.jsx)(`button`,{type:`button`,onClick:()=>G({task:e}),className:`min-w-0 truncate rounded-md px-1.5 py-1 text-left text-sm text-stone-800 hover:bg-stone-100`,children:e.title})]})}),(0,V.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,V.jsx)(g,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`任务状态`,menuMinWidth:120,options:_e,value:e.status,onChange:t=>void $(e.id,{status:t}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${pe[e.status]}`,renderTrigger:()=>(0,V.jsx)(`span`,{className:`truncate`,children:D[e.status]}),renderOptionPrefix:e=>(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full ${he[e.value]}`})})}),(0,V.jsx)(`td`,{className:`px-1.5 py-1 align-middle`,children:(0,V.jsx)(g,{unstyled:!0,hideChevron:!0,centerContent:!0,ariaLabel:`紧急程度`,menuMinWidth:128,options:ve,value:e.priority,onChange:t=>void $(e.id,{priority:t}),triggerClassName:`h-7 max-w-full rounded-md px-2 text-center text-xs font-medium focus:ring-2 focus:ring-[#3370ff]/30 ${me[e.priority]}`,renderTrigger:()=>(0,V.jsx)(`span`,{className:`truncate`,children:e.priority?A[e.priority]:`未设置`}),renderOptionPrefix:e=>(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full ${ge[e.value]}`})})}),(0,V.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,V.jsx)(h,{value:e.startDate,onChange:t=>void $(e.id,{startDate:t}),placeholder:`选择日期`,className:`h-8 rounded-md px-1.5 text-sm tabular-nums`})}),(0,V.jsx)(`td`,{className:`px-1 py-1 align-middle`,children:(0,V.jsx)(h,{value:e.dueDate,onChange:t=>void $(e.id,{dueDate:t}),placeholder:`选择日期`,className:`h-8 rounded-md px-1.5 text-sm tabular-nums`})}),(0,V.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs whitespace-nowrap text-stone-500 tabular-nums`,children:t===null?`—`:`${t} 天`}),(0,V.jsx)(`td`,{className:`px-2 py-1 align-middle text-xs text-stone-500 tabular-nums`,children:d?n.total?`${n.total} 条`:`0`:(0,V.jsx)(`span`,{className:`whitespace-nowrap text-stone-400`,children:`待办事项未启用`})}),(0,V.jsx)(`td`,{className:`px-2 py-1 align-middle`,children:d?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,V.jsx)(`span`,{className:`block h-full rounded-full bg-[#3370ff] transition-[width]`,style:{width:`${n.percent}%`}})}),(0,V.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs text-stone-500 tabular-nums`,children:[n.percent,`%`]})]}):(0,V.jsx)(`span`,{className:`whitespace-nowrap text-xs text-stone-400`,children:`待办事项未启用`})}),(0,V.jsx)(`td`,{className:`truncate px-2 py-1 align-middle text-xs text-stone-500`,children:e.note||`—`}),(0,V.jsx)(`td`,{"aria-hidden":`true`}),(0,V.jsx)(`td`,{className:b,children:(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>G({task:e}),"aria-label":`展开 ${e.title}`,className:`rounded p-1 text-stone-300 transition-colors hover:bg-stone-100 hover:text-stone-600 focus:text-stone-600`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M14 4h6v6`}),(0,V.jsx)(`path`,{d:`M20 4 13 11`}),(0,V.jsx)(`path`,{d:`M10 20H4v-6`}),(0,V.jsx)(`path`,{d:`M4 20l7-7`})]})}),(0,V.jsx)(`button`,{type:`button`,disabled:P,onClick:()=>q(e),"aria-label":`删除 ${e.title}`,className:`tw-icon-danger rounded p-1`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M3 6h18`}),(0,V.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,V.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,V.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})]})})]},e.id)}),Q.length===0?(0,V.jsx)(`tr`,{children:(0,V.jsx)(`td`,{colSpan:11,className:`px-3 py-16 text-center text-sm text-stone-400`,children:T.length===0?`还没有任务`:`没有匹配的任务,试试调整搜索或筛选`})}):null]})]})}),(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-stone-100 px-4 py-2.5 text-xs text-stone-500`,children:[(0,V.jsxs)(`span`,{children:[`共 `,Q.length,` 条`]}),(0,V.jsx)(`span`,{className:`ml-auto text-stone-400`,children:`任务下关联的待办可直接在「待办事项」里维护`})]})]}),(0,V.jsx)(Ee,{open:Oe!==null,task:Oe?.task??null,todos:O,onClose:()=>G(null),onSaved:X}),(0,V.jsx)(m,{open:K!=null,title:`删除任务`,message:`删除「${K?.title??``}」?已关联的待办会保留,但不再挂在该任务下。`,confirmLabel:`删除`,cancelLabel:`取消`,danger:!0,onClose:()=>q(null),onConfirm:()=>void Fe()})]}):(0,V.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:`任务管理需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`}):(0,V.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:ee(`tasks`)}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,V.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}export{De as default};