lantern-harness 0.1.6 → 0.1.8

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 (91) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/builtin/session/update-check.mjs +517 -0
  4. package/cli/lantern.mjs +123 -22
  5. package/cli/server.mjs +5 -2
  6. package/dist/500.html +3 -3
  7. package/dist/_astro/Base.DjIEQkT7.css +1 -0
  8. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.D0snmAJ_.js +1 -0
  9. package/dist/_astro/{CaseExecBoard.FJ1Y9b4e.js → CaseExecBoard.BAV4EE3o.js} +1 -1
  10. package/dist/_astro/{CaseGenerateApp.CT2n4VOf.js → CaseGenerateApp.Bz4ryNJG.js} +1 -1
  11. package/dist/_astro/{CasesLibrary.BjrehOiI.js → CasesLibrary.BPifyHUA.js} +1 -1
  12. package/dist/_astro/{ChatApp.Dqfx4FcI.js → ChatApp.DLo31SYZ.js} +5 -5
  13. package/dist/_astro/{DashboardBoard.wILBO_CD.js → DashboardBoard.Bd3eUPwZ.js} +2 -2
  14. package/dist/_astro/{DocsFileBrowser.D32MgVAR.js → DocsFileBrowser.D3cKurQE.js} +1 -1
  15. package/dist/_astro/{DocsPager.BARD7JvD.js → DocsPager.rzu4mnzw.js} +1 -1
  16. package/dist/_astro/{KnowledgeLibrary.C-Sg2R6B.js → KnowledgeLibrary.B0sO4QR1.js} +1 -1
  17. package/dist/_astro/{NavLibraries.BzInZVDf.js → NavLibraries.Cvg3wery.js} +1 -1
  18. package/dist/_astro/{PluginsPage.CVyua_fb.js → PluginsPage.DIltPILi.js} +2 -2
  19. package/dist/_astro/PluginsPage.uvmSuXzi.js +1 -0
  20. package/dist/_astro/PmBugsBoard.CiaIhCHv.js +1 -0
  21. package/dist/_astro/PmIterationsBoard.H67QwKFw.js +1 -0
  22. package/dist/_astro/{PmProjectDetail.CtQdpGes.js → PmProjectDetail.DqDoIg8a.js} +1 -1
  23. package/dist/_astro/PmProjectsBoard.nOC1Hugt.js +1 -0
  24. package/dist/_astro/PmRequirementsBoard.BPjZ7khP.js +1 -0
  25. package/dist/_astro/PmRequirementsBoard.CanxvcKg.js +1 -0
  26. package/dist/_astro/PmShared.CZnXaUq-.js +1 -0
  27. package/dist/_astro/{PromptsLibrary.Z1DQBrFL.js → PromptsLibrary.DU9EuSim.js} +1 -1
  28. package/dist/_astro/{ReportsPage.CGpIPPr9.js → ReportsPage.Cr88iz8c.js} +1 -1
  29. package/dist/_astro/{RequirementsLibrary.D8078xLd.js → RequirementsLibrary.BwriF8F0.js} +1 -1
  30. package/dist/_astro/{SearchableSelect.BTJoZC_a.js → SearchableSelect.Ctg8V1Z1.js} +1 -1
  31. package/dist/_astro/SettingsDialog.DEgsVfaL.js +1 -0
  32. package/dist/_astro/SpaceSwitcher.BEJo5KFi.js +7 -0
  33. package/dist/_astro/{TasksBoard.CL-sNPZN.js → TasksBoard.BZi_GBPG.js} +1 -1
  34. package/dist/_astro/{TemplatesLibrary.d6uIe7I-.js → TemplatesLibrary.T4K9jUex.js} +1 -1
  35. package/dist/_astro/{TestStatsBoard.CSdXWc4Q.js → TestStatsBoard.Dd1Kcmx6.js} +1 -1
  36. package/dist/_astro/{TodosBoard.nl23X5Gi.js → TodosBoard.C4yd_JFb.js} +1 -1
  37. package/dist/_astro/app-config.DKMxjv3g.js +1 -0
  38. package/dist/_astro/i18n.BXeGGutk.js +7 -0
  39. package/dist/_astro/{open-docs-in-session.B5cUxqHi.js → open-docs-in-session.B0ZdZNj2.js} +1 -1
  40. package/dist/_astro/{plugins.DaDJq-mn.js → plugins.D5ypJIXn.js} +1 -1
  41. package/dist/_astro/pm.BsnTv63L.js +4 -0
  42. package/dist/_astro/{settings.CMK4PEak.js → settings.CnDCvwnQ.js} +2 -2
  43. package/dist/_astro/{spaces-client.CoQfaOIO.js → spaces-client.Cai2tHEI.js} +1 -1
  44. package/dist/_astro/update.DXCPfU4a.js +1 -0
  45. package/dist/_astro/{view-prefs.Dhdh8Z5a.js → view-prefs.HCowOWXL.js} +1 -1
  46. package/dist/case-exec/index.html +4 -4
  47. package/dist/cases/generate/index.html +4 -4
  48. package/dist/cases/library/index.html +4 -4
  49. package/dist/dashboard/index.html +4 -4
  50. package/dist/docs/changelog/index.html +25 -4
  51. package/dist/docs/install/index.html +3 -3
  52. package/dist/docs/manual/index.html +15 -5
  53. package/dist/index.html +4 -4
  54. package/dist/knowledge/index.html +4 -4
  55. package/dist/knowledge//345/212/237/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/347/274/226/345/206/231/350/247/204/350/214/203/index.html +3 -3
  56. package/dist/plugins/index.html +4 -4
  57. package/dist/pm/bugs/index.html +4 -4
  58. package/dist/pm/iterations/index.html +4 -4
  59. package/dist/pm/projects/detail/index.html +4 -4
  60. package/dist/pm/projects/index.html +4 -4
  61. package/dist/pm/requirements/index.html +4 -4
  62. package/dist/prompts/index.html +4 -4
  63. package/dist/reports/index.html +4 -4
  64. package/dist/requirements/index.html +4 -4
  65. package/dist/tasks/index.html +4 -4
  66. package/dist/templates/index.html +4 -4
  67. package/dist/templates//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//345/212/237/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  68. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212//346/200/247/350/203/275/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  69. package/dist/templates//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213//346/200/247/350/203/275/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  70. package/dist/templates//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212//346/216/245/345/217/243/346/265/213/350/257/225/346/212/245/345/221/212/346/250/241/346/235/277/index.html +3 -3
  71. package/dist/templates//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213//350/207/252/345/212/250/345/214/226/346/265/213/350/257/225/347/224/250/344/276/213/346/250/241/346/235/277/index.html +3 -3
  72. package/dist/test-stats/index.html +4 -4
  73. package/dist/todos/index.html +4 -4
  74. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +13 -2
  75. package/lh-plugins/lh-pm.mjs +18 -4
  76. package/lh-plugins/lh-update.mjs +171 -0
  77. package/package.json +1 -1
  78. package/dist/_astro/Base.DGaLtzMo.css +0 -1
  79. package/dist/_astro/Base.astro_astro_type_script_index_0_lang.uhTNjhRY.js +0 -1
  80. package/dist/_astro/PluginsPage.CS1GaJtR.js +0 -1
  81. package/dist/_astro/PmBugsBoard.BXUu0kNL.js +0 -1
  82. package/dist/_astro/PmIterationsBoard.Deso1uyK.js +0 -1
  83. package/dist/_astro/PmProjectsBoard.MM4vxneK.js +0 -1
  84. package/dist/_astro/PmRequirementsBoard.62ONLCH5.js +0 -1
  85. package/dist/_astro/PmRequirementsBoard.SLVDgspp.js +0 -1
  86. package/dist/_astro/PmShared.CwCmF-kI.js +0 -1
  87. package/dist/_astro/SettingsDialog.BA57gp90.js +0 -1
  88. package/dist/_astro/SpaceSwitcher.DZ8b_85M.js +0 -7
  89. package/dist/_astro/app-config.huKxSIlN.js +0 -1
  90. package/dist/_astro/i18n.Bbh04ngD.js +0 -7
  91. package/dist/_astro/pm.CpFmMslU.js +0 -4
@@ -1 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{a as n,i as r,n as i,s as ee}from"./app-config.huKxSIlN.js";import{i as a,n as te,r as ne,t as re}from"./listbox.Di-t5U37.js";import{a as ie,o as ae}from"./dialog.DXHznyjD.js";import{t as o}from"./jsx-runtime.BUXbF_vF.js";import{t as oe}from"./ConfirmDialog.CBVsDJ8f.js";import{i as se}from"./llm.BZEzE0x2.js";import{_ as ce,a as s,c as le,d as ue,g as c,h as de,i as fe,l,n as u,o as pe,r as me,s as he,t as ge,u as _e,v as ve}from"./settings.CMK4PEak.js";import{n as d}from"./i18n.Bbh04ngD.js";var f=e(t(),1),ye=`0.1.6`,p=o();function be(e){try{return new URL(e).host}catch{return``}}var xe=[{value:`zh-CN`,label:`中文`},{value:`en`,label:`English`}],m=`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`,h=`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 Se({className:e=`w-3.5 h-3.5`}){return(0,p.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,children:(0,p.jsx)(`path`,{d:`M6 8l4 4 4-4`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function g({className:e=`w-4 h-4`}){return(0,p.jsx)(`svg`,{className:e,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,p.jsx)(`path`,{d:`M5 10.5l3.5 3.5L15 6.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Ce({className:e=`w-4 h-4`}){return(0,p.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,p.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 we({className:e=`w-4 h-4`}){return(0,p.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,p.jsx)(`path`,{d:`M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5`}),(0,p.jsx)(`path`,{d:`M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6`})]})}function Te({kind:e}){let t=`w-5 h-5`;return e===`sun`?(0,p.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,p.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,p.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,p.jsx)(`path`,{d:`M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z`})}):(0,p.jsxs)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:[(0,p.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,p.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function _({title:e,description:t,control:n}){return(0,p.jsxs)(`div`,{className:`flex items-center gap-4 py-4 border-b border-stone-100 last:border-b-0`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`div`,{className:`text-sm font-medium text-stone-800`,children:e}),t?(0,p.jsx)(`div`,{className:`mt-0.5 text-xs text-stone-400 leading-5`,children:t}):null]}),(0,p.jsx)(`div`,{className:`shrink-0`,children:n})]})}function v({value:e,options:t,onChange:n}){let r=t.find(t=>t.value===e)?.label??e;return(0,p.jsxs)(ne,{value:e,onChange:n,children:[(0,p.jsxs)(a,{className:h,children:[(0,p.jsx)(`span`,{className:`flex-1 text-left truncate`,children:r}),(0,p.jsx)(Se,{className:`w-3.5 h-3.5 text-stone-400 shrink-0`})]}),(0,p.jsx)(re,{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,p.jsxs)(te,{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,p.jsx)(`span`,{children:e.label}),(0,p.jsx)(g,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0`})]},e.value))})]})}function y(){let[e,t]=(0,f.useState)(!1),[o,h]=(0,f.useState)(`general`),[y,b]=(0,f.useState)([]),[x,S]=(0,f.useState)(``),[C,w]=(0,f.useState)(null),[T,E]=(0,f.useState)(``),[Ee,D]=(0,f.useState)(`DeepSeek`),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(``),[M,N]=(0,f.useState)(``),[P,F]=(0,f.useState)([]),[I,L]=(0,f.useState)(`idle`),[De,R]=(0,f.useState)(!1),[Oe,z]=(0,f.useState)(`readonly`),[ke,Ae]=(0,f.useState)(!1),[je,B]=(0,f.useState)(!1),[Me,V]=(0,f.useState)(null),[H,U]=(0,f.useState)({language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``}),[W,G]=(0,f.useState)(`14`),K=(0,f.useRef)(0),q=C!==null,J=H.language,Y=y.find(e=>e.id===x),X=(Y?.name||``).trim(),Ne=X||(J===`en`?`No model`:`未配置`),Pe=X?Y?.model?.trim()?`${X} · ${Y.model.trim()}`:X:J===`en`?`No model configured`:`未配置模型`;function Fe(e=`general`){h(e),r().then(()=>{Z(),t(!0)})}function Z(){Ae(n()),b(le()),S(s()),B(!!l()),U(he()),me(he()),z(pe()),w(null)}function Ie(e){if(!e){let e=ee();w(e),E(`DeepSeek`),D(`DeepSeek`),k(`https://api.deepseek.com/v1`),j(``),N(``),F([]),L(`idle`),R(!1);return}w(e.id),E(e.name),k(e.baseURL);let t=e.apiKey?.trim()||(e.id===s()?i().trim():``)||``;j(t),N(e.model),F(e.availableModels??[]),L(e.availableModels?.length?`ok`:`idle`),D(u.find(t=>t.baseURL===e.baseURL)?.label??`自定义`),R(!1)}(0,f.useEffect)(()=>{r().then(()=>Z());let e=e=>{let n=e.detail;h(n?.tab===`model`?`model`:`general`),r().then(()=>{Z(),t(!0)})};window.addEventListener(ge,e);let n=ue(e=>U(e)),i=_e(e=>z(e));return()=>{window.removeEventListener(ge,e),n(),i()}},[]),(0,f.useEffect)(()=>{if(!e||o!==`model`||!q)return;let t=O.trim(),n=A.trim();if(!t||!n){L(e=>e===`ok`?`ok`:`idle`);return}L(`loading`);let r=++K.current,i=setTimeout(()=>{se(t,n).then(e=>{r===K.current&&(F(e),L(`ok`))}).catch(()=>{r===K.current&&L(`fail`)})},800);return()=>clearTimeout(i)},[e,o,q,O,A]);function Le(e){D(e);let t=u.find(t=>t.label===e);t&&(t.baseURL&&k(t.baseURL),(!T.trim()||u.some(e=>e.label===T))&&E(t.label)),N(``)}function Q(e){U(c(e))}(0,f.useEffect)(()=>{G(String(H.sessionFontSize))},[H.sessionFontSize]);function Re(){let e=Number(W);if(!W.trim()||!Number.isFinite(e)){G(String(H.sessionFontSize));return}let t=c({sessionFontSize:Math.round(e)});U(t),G(String(t.sessionFontSize))}let ze=!!(T.trim()&&O.trim()&&A.trim()&&M.trim()),$=P.length>0;function Be(){if(!ze||!C)return;let e=ve({id:C,name:T.trim(),baseURL:O.trim(),apiKey:A.trim(),model:M.trim(),availableModels:$?P:void 0},{activate:!0});b(e),S(C),w(null),B(!!l())}function Ve(e){V(e)}function He(){let e=Me;if(!e)return;V(null);let t=fe(e);b(t),S(s()),C===e&&w(null),B(!!l())}function Ue(e){ce(e),S(e),B(!!l())}let We=[{value:`readonly`,label:d(`settings.access.readonly`,void 0,J)},{value:`readwrite`,label:d(`settings.access.readwrite`,void 0,J)},{value:`full`,label:d(`settings.access.full`,void 0,J)}],Ge=[{value:`concise`,label:d(`settings.step.concise`,void 0,J)},{value:`standard`,label:d(`settings.step.standard`,void 0,J)},{value:`detailed`,label:d(`settings.step.detailed`,void 0,J)},{value:`full`,label:d(`settings.step.full`,void 0,J)}],Ke=[{value:`queue`,label:d(`settings.busySend.queue`,void 0,J)},{value:`interrupt`,label:d(`settings.busySend.interrupt`,void 0,J)}],qe=[{value:`light`,label:d(`settings.appear.light`,void 0,J),icon:`sun`},{value:`dark`,label:d(`settings.appear.dark`,void 0,J),icon:`moon`},{value:`system`,label:d(`settings.appear.system`,void 0,J),icon:`monitor`}],Je=[{id:`general`,label:d(`settings.general`,void 0,J),icon:(0,p.jsx)(Ce,{})},{id:`model`,label:d(`settings.model`,void 0,J),icon:(0,p.jsx)(we,{})}],Ye=o===`general`?d(`settings.general`,void 0,J):q?y.some(e=>e.id===C)?d(`settings.editProvider`,void 0,J):d(`settings.addProviderTitle`,void 0,J):d(`settings.model`,void 0,J);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`tw-nav-foot-row`,children:[(0,p.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`general`),className:`tw-nav-settings-btn`,"data-hint":je?`设置(已配置模型)`:`设置`,children:[(0,p.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,p.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,p.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,p.jsx)(`span`,{"data-i18n":`nav.settings`,children:d(`nav.settings`,void 0,J)})]}),(0,p.jsxs)(`button`,{type:`button`,className:`tw-nav-provider-chip${X?``:` is-empty`}`,"data-hint":Pe,onClick:()=>Fe(`model`),children:[(0,p.jsx)(`span`,{className:`tw-nav-provider-dot`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`tw-nav-provider-name`,children:Ne})]})]}),(0,p.jsx)(ie,{show:e,children:(0,p.jsxs)(`div`,{className:`fixed inset-0 z-110 flex items-center justify-center p-4`,children:[(0,p.jsx)(ae,{children:(0,p.jsx)(`div`,{className:`tw-dialog-backdrop-anim absolute inset-0 bg-stone-950/45`,onClick:()=>t(!1),"aria-hidden":`true`})}),(0,p.jsx)(ae,{children:(0,p.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,p.jsxs)(`div`,{className:`shrink-0 h-12 px-4 flex items-center justify-between border-b border-stone-100 bg-white`,children:[(0,p.jsx)(`h2`,{className:`text-sm font-semibold text-stone-800 truncate pr-3`,children:Ye}),(0,p.jsx)(`button`,{type:`button`,"aria-label":d(`settings.close`,void 0,J),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,p.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,children:(0,p.jsx)(`path`,{d:`M5 5l10 10M15 5L5 15`,strokeLinecap:`round`})})})]}),(0,p.jsxs)(`div`,{className:`flex-1 min-h-0 flex`,children:[(0,p.jsx)(`aside`,{className:`w-38 shrink-0 border-r border-stone-100 bg-[#f4f5f7] py-3 px-2 space-y-0.5`,children:Je.map(e=>{let t=o===e.id;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>{h(e.id),e.id===`model`&&w(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,p.jsx)(`span`,{className:t?`text-[#4176e6]`:`text-stone-400`,children:e.icon}),e.label]},e.id)})}),(0,p.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0 bg-white`,children:o===`general`?(0,p.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-1`,children:[(0,p.jsx)(_,{title:d(`settings.access`,void 0,J),description:d(`settings.accessDesc`,void 0,J),control:(0,p.jsx)(v,{value:Oe,options:We,onChange:e=>{z(e),de(e)}})}),(0,p.jsx)(_,{title:d(`settings.language`,void 0,J),control:(0,p.jsx)(v,{value:H.language,options:xe,onChange:e=>Q({language:e})})}),(0,p.jsxs)(`div`,{className:`py-4 border-b border-stone-100`,children:[(0,p.jsx)(`div`,{className:`text-sm font-medium text-stone-800 mb-3`,children:d(`settings.appearance`,void 0,J)}),(0,p.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5`,children:qe.map(e=>{let t=H.appearance===e.value;return(0,p.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,p.jsx)(Te,{kind:e.icon}),(0,p.jsx)(`span`,{className:`text-xs font-medium`,children:e.label})]},e.value)})})]}),(0,p.jsx)(_,{title:d(`settings.fontSize`,void 0,J),description:d(`settings.fontSizeDesc`,void 0,J),control:(0,p.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,p.jsx)(`input`,{type:`number`,min:12,max:22,value:W,onChange:e=>G(e.target.value),onBlur:Re,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,p.jsx)(`span`,{className:`text-sm text-stone-400`,children:`px`})]})}),(0,p.jsx)(_,{title:d(`settings.toolSteps`,void 0,J),description:d(`settings.toolStepsDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.toolStepDetail,options:Ge,onChange:e=>Q({toolStepDetail:e})})}),(0,p.jsx)(_,{title:d(`settings.busySend`,void 0,J),description:d(`settings.busySendDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.busySendBehavior,options:Ke,onChange:e=>Q({busySendBehavior:e})})}),(0,p.jsx)(_,{title:d(`settings.subagentModel`,void 0,J),description:d(`settings.subagentModelDesc`,void 0,J),control:(0,p.jsx)(v,{value:H.subagentModel?.trim()?H.subagentModel:`inherit`,options:[{value:`inherit`,label:d(`settings.subagentModel.inherit`,void 0,J)},...Array.from(new Set([...Y?.availableModels??[],...Y?.model?[Y.model]:[]])).filter(Boolean).map(e=>({value:e,label:e}))],onChange:e=>Q({subagentModel:e===`inherit`?``:e})})})]}),(0,p.jsxs)(`div`,{className:`shrink-0 px-6 py-3 border-t border-stone-100 flex items-center justify-between text-[11px] text-stone-400`,children:[(0,p.jsx)(`span`,{children:d(`settings.platformVersion`,void 0,J)}),(0,p.jsxs)(`span`,{className:`tabular-nums text-stone-500`,children:[`v`,ye]})]})]}):q?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`shrink-0 px-5 pt-3 pb-2 flex items-center gap-2 border-b border-stone-100`,children:(0,p.jsx)(`button`,{type:`button`,onClick:()=>w(null),className:`text-sm text-stone-500 hover:text-stone-800`,children:d(`settings.back`,void 0,J)})}),(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.displayName`,void 0,J)}),(0,p.jsx)(`input`,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:`DeepSeek`,className:m})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.preset`,void 0,J)}),(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:u.map(e=>{let t=Ee===e.label;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>Le(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,p.jsx)(`div`,{className:`text-sm ${t?`text-[#3565c7] font-medium`:`text-stone-700`}`,children:e.label}),(0,p.jsx)(`div`,{className:`text-[11px] text-stone-400 truncate`,children:e.baseURL?be(e.baseURL):`OpenAI compatible`})]},e.label)})})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.baseUrl`,void 0,J)}),(0,p.jsx)(`input`,{type:`text`,value:O,onChange:e=>k(e.target.value),placeholder:`https://api.deepseek.com/v1`,className:m})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{className:`block text-xs font-medium text-stone-500 mb-1.5`,children:d(`settings.apiKey`,void 0,J)}),(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(`input`,{type:De?`text`:`password`,value:A,onChange:e=>j(e.target.value),placeholder:`sk-...`,className:`${m} pr-14`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>R(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:De?J===`en`?`Hide`:`隐藏`:J===`en`?`Show`:`显示`})]}),ke?(0,p.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-5`,children:d(`settings.keyHint`,void 0,J)}):null]}),(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,p.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:d(`settings.modelField`,void 0,J)}),I===`loading`&&(0,p.jsx)(`span`,{className:`text-[11px] text-stone-400`,children:d(`settings.recognizing`,void 0,J)}),$&&I===`ok`&&(0,p.jsx)(`span`,{className:`text-[11px] text-emerald-600`,children:d(`settings.recognized`,{n:P.length},J)}),I===`fail`&&!$&&(0,p.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:d(`settings.recognizeFail`,void 0,J)}),I===`fail`&&$&&(0,p.jsx)(`span`,{className:`text-[11px] text-amber-600`,children:d(`settings.recognizeKeep`,void 0,J)})]}),$?(0,p.jsxs)(ne,{value:M,onChange:N,children:[(0,p.jsxs)(a,{className:`${m} flex items-center justify-between text-left hover:border-stone-400 cursor-pointer`,children:[(0,p.jsx)(`span`,{className:`truncate text-stone-800`,children:M||(J===`en`?`Select a model`:`请选择模型`)}),(0,p.jsx)(Se,{className:`w-4 h-4 shrink-0 ml-2 text-stone-400`})]}),(0,p.jsx)(re,{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,p.jsxs)(te,{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,p.jsx)(`span`,{className:`truncate`,children:e}),(0,p.jsx)(g,{className:`w-4 h-4 text-[#4176e6] opacity-0 group-data-[selected]:opacity-100 shrink-0 ml-2`})]},e))})]}):(0,p.jsx)(`input`,{type:`text`,value:M,onChange:e=>N(e.target.value),placeholder:d(`settings.modelPlaceholder`,void 0,J),className:m})]})]}),(0,p.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,p.jsx)(`button`,{type:`button`,onClick:()=>w(null),className:`px-3.5 py-1.5 text-sm text-stone-600 hover:bg-stone-200/60 rounded-lg`,children:d(`settings.cancel`,void 0,J)}),(0,p.jsx)(`button`,{type:`button`,onClick:Be,disabled:!ze,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:d(`settings.save`,void 0,J)})]})]}):(0,p.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-5 bg-[#f4f5f7]`,children:[(0,p.jsx)(`p`,{className:`text-sm text-stone-500`,children:d(`settings.modelIntro`,void 0,J)}),(0,p.jsxs)(`div`,{className:`mt-5 space-y-2.5`,children:[y.map(e=>{let t=!!(e.apiKey?.trim()&&e.baseURL.trim()&&e.model.trim()),n=e.id===x;return(0,p.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,p.jsxs)(`button`,{type:`button`,"data-hint":n?J===`en`?`Active`:`当前使用`:J===`en`?`Set active`:`设为当前`,onClick:()=>Ue(e.id),className:`flex-1 min-w-0 flex items-center gap-2 text-left`,children:[(0,p.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:e.name}),t?(0,p.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 bg-emerald-500`}):null]}),(0,p.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ie(e),className:`h-8 px-3 text-sm text-stone-700 rounded-lg border border-stone-200 bg-white hover:bg-stone-50`,children:d(`settings.edit`,void 0,J)}),y.length>1?(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ve(e.id),className:`h-8 px-3 text-sm text-red-600 rounded-lg hover:bg-red-50`,children:d(`settings.delete`,void 0,J)}):null]})]},e.id)}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>Ie(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:d(`settings.addProvider`,void 0,J)})]})]})})]})]})})]})}),(0,p.jsx)(oe,{open:Me!=null,title:d(`settings.delete`,void 0,J),message:d(`settings.deleteConfirm`,void 0,J),confirmLabel:d(`settings.delete`,void 0,J),cancelLabel:J===`en`?`Cancel`:`取消`,danger:!0,onClose:()=>V(null),onConfirm:He})]})}export{y as default};
@@ -1,7 +0,0 @@
1
- import{c as e,n as t}from"./react-dom.CqAxpHMt.js";import{f as n,i as r}from"./app-config.huKxSIlN.js";import{i,n as a,r as o,t as s}from"./dialog.DXHznyjD.js";import{i as c,n as l,r as ee,t as u}from"./menu.Bkluqxic.js";import{t as d}from"./jsx-runtime.BUXbF_vF.js";import{t as f}from"./ConfirmDialog.CBVsDJ8f.js";import{n as p}from"./llm.BZEzE0x2.js";import{f as m}from"./project-docs.Cd2gKPKh.js";import{t as h}from"./prompts-meta.F4wwkjUA.js";import{l as te}from"./settings.CMK4PEak.js";import{n as g}from"./i18n.Bbh04ngD.js";import{a as _,c as ne,d as re,f as v,i as y,l as ie,m as ae,n as oe,o as b,p as se,r as ce,s as le,t as ue,u as de}from"./spaces-client.CoQfaOIO.js";var x=e(t(),1),fe=`你是提示词作者。根据用户对这个数据空间的要求,写一份「默认提示词」正文(Markdown 纯文本,不要用代码围栏)。
2
- 这份提示词将作为 Lantern Harness 该空间里 AI 助手的默认人设与回答原则。
3
- 要求:
4
- - 用「你是…」起头设定角色;
5
- - 紧扣用户描述的领域与工作方式;
6
- - 写几条简洁的回答原则(问什么答什么、先结论);
7
- - 只输出提示词正文,不要解释、不要标题。`;function pe(e){let t=String(e??``).replace(/^\uFEFF/,``).trim(),n=/^```(?:markdown|md|text)?\s*\n([\s\S]*?)\n```$/i.exec(t);return n&&(t=n[1].trim()),t}var S=d();function me(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function he({hint:e,children:t}){return e?(0,S.jsx)(`span`,{className:`inline-flex cursor-help`,"data-hint":e,"data-hint-always":``,children:t}):t}function ge(e){let{value:t,onChange:n,onGenerate:r,onStop:i,generating:a,disabled:o}=e,s=(0,x.useRef)(null);(0,x.useLayoutEffect)(()=>{let e=s.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,96)}px`)},[t]);let c=!!t.trim()&&!a&&!o;return(0,S.jsxs)(`div`,{className:`tw-space-prompt-composer pt-1 rounded-lg bg-white border border-stone-200 outline-none transition-colors focus-within:ring-2 focus-within:ring-[#4176e6]/30 focus-within:border-[#4176e6]`,children:[(0,S.jsx)(`textarea`,{ref:s,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),a){i();return}c&&r()}},placeholder:g(`space.promptBriefPlaceholder`),rows:1,disabled:o,className:`block w-full min-h-6 pl-3.5 pr-2 pt-0.5 pb-0 text-sm leading-5 text-stone-800 bg-transparent resize-none focus:outline-none placeholder:text-stone-400 disabled:opacity-60`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-2 px-3 pb-2 pt-1`,children:[(0,S.jsx)(`span`,{className:`flex-1`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>a?i():r(),disabled:!a&&!c,"aria-label":g(a?`space.promptStop`:`space.promptGenerate`),className:`w-7 h-7 shrink-0 rounded-full flex items-center justify-center outline-none transition-colors ${a?`bg-stone-200 text-stone-700 hover:bg-stone-300`:`bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:bg-[#a9c3ef] disabled:cursor-not-allowed`}`,children:a?(0,S.jsx)(`span`,{className:`w-2.5 h-2.5 bg-current rounded-xs`}):(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,className:`w-4 h-4`,"aria-hidden":!0,children:[(0,S.jsx)(`path`,{d:`m5 12 7-7 7 7`}),(0,S.jsx)(`path`,{d:`M12 19V5`})]})})]})]})}function _e(e){return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2 mb-1.5`,children:[(0,S.jsx)(`label`,{className:`text-xs font-medium text-stone-500`,children:g(`space.promptBodyLabel`)}),(0,S.jsx)(`span`,{className:`text-[11px] text-stone-400 font-mono truncate`,children:h})]}),(0,S.jsx)(`textarea`,{value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:g(`space.promptBodyPlaceholder`),rows:8,disabled:e.disabled,className:`w-full min-h-36 px-3 py-2 text-sm leading-relaxed rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors resize-y font-[inherit]`}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[11px] text-stone-400 leading-snug`,children:e.hint??g(`space.promptHint`)})]})}function C({open:e,onClose:t,onListChanged:c}){let[l,ee]=(0,x.useState)(null),[u,d]=(0,x.useState)(null),[v,C]=(0,x.useState)(``),[w,T]=(0,x.useState)(``),[E,D]=(0,x.useState)(!1),[O,k]=(0,x.useState)(``),[A,ve]=(0,x.useState)(``),[ye,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(null),[P,F]=(0,x.useState)(``),[I,L]=(0,x.useState)(``),[be,R]=(0,x.useState)(``),[z,xe]=(0,x.useState)(!1),[Se,B]=(0,x.useState)(!1),[V,H]=(0,x.useState)(null),[U,W]=(0,x.useState)(null),[Ce,we]=(0,x.useState)(``),[G,K]=(0,x.useState)([]),[Te,q]=(0,x.useState)({}),Ee=(0,x.useRef)(null),De=(0,x.useRef)(null),Oe=(0,x.useRef)(null),J=(0,x.useRef)(null),[ke,Ae]=(0,x.useState)(null),Y=(0,x.useCallback)(async(e=!1)=>{e&&d(`stats`);let t=await re({stats:e});e&&d(null),t?(ee(t),c?.(t)):C(`无法读取数据空间列表(本地服务未运行?)`)},[c]),je=(0,x.useRef)(Y);(0,x.useEffect)(()=>{je.current=Y},[Y]);function X(){J.current?.abort()}(0,x.useEffect)(()=>{e?(C(``),T(``),D(!1),N(null),je.current(!1)):(X(),D(!1),N(null),Ae(null))},[e]);async function Me(e){if(ke||u!==null)return;let t=(e===`create`?A:I).trim();if(!t){C(g(`space.promptNeedReq`));return}C(``);let n=new AbortController;J.current=n,Ae(e);try{await r();let i=te();if(!i?.apiKey?.trim()||!i.model?.trim()||!i.baseURL?.trim()){C(g(`space.promptNeedModel`));return}let a=(e===`create`?O:P).trim(),o=await p(i,[{role:`system`,content:fe},{role:`user`,content:(a?`空间名称:${a}\n\n`:``)+`用户要求:\n${t}`}],n.signal);if(n.signal.aborted)return;let s=pe(o);if(!s){C(g(`space.promptGenEmpty`));return}e===`create`?j(s):R(s)}catch(e){if(me(e)||n.signal.aborted)return;C(e instanceof Error?e.message:String(e))}finally{J.current===n&&(J.current=null),Ae(null)}}function Ne(){X(),C(``),T(``),k(``),ve(``),j(``),D(!0),requestAnimationFrame(()=>De.current?.scrollIntoView({block:`nearest`}))}async function Pe(){if(u!==null)return;let e=O.trim();if(!e){C(g(`space.needName`));return}X();let t=ye.trim(),r=A.trim();d(`create`),C(``);let i=await oe(e,{switch:!0,...t?{systemPrompt:t}:{},...r?{promptBrief:r}:{}});if(d(null),!i.ok){C(i.error||g(`space.create`)+` 失败`);return}let a=i.space?.id;a&&n(a),window.location.reload()}async function Fe(e){X(),C(``),T(``),N(e),F(e.name),L(``),B(!1),R(``),xe(!0),requestAnimationFrame(()=>Oe.current?.scrollIntoView({block:`nearest`}));let t=await ne(e.id),n=``,r=``;if(t.ok)n=t.brief??``,r=t.systemPrompt??``;else if(e.isActive)try{r=(await m(`prompts`,h)).content.trim()}catch{}if(xe(!1),!t.ok&&!r){N(null),C(t.error||g(`space.detailFailed`));return}t.space&&F(t.space.name),R(r);let i=!n.trim()&&!!r;L(i?r:n),B(i)}async function Ie(){if(!M||u!==null)return;let e=P.trim();if(!e){C(g(`space.needName`));return}X(),d(`update`),C(``);let t=await ae(M.id,{name:e,...Se?{}:{brief:I},systemPrompt:be});if(d(null),!t.ok){C(t.error||g(`space.updateFailed`));return}let n=!!(t.space&&t.space.name!==M.name),r=M.isActive;N(null),T(g(`space.updated`,{name:t.space?.name??e})),n&&r?window.location.reload():await Y(!1)}async function Le(e){if(e.isActive||u!==null)return;d(`update`),C(``);let t=await se(e.id);d(null),t.ok?window.location.reload():C(t.error||`切换失败`)}async function Re(){if(!U)return;let e=Ce.trim();if(!e)return;d(`copy`),C(``);let t=await ue(U.id,e);d(null),t.ok?(W(null),T(`已复制为「${t.space?.name}」`),await Y(!1)):C(t.error||`复制失败`)}async function ze(e,t){d(`delete`),C(``);let r=await ce(e.id,t);d(null),r.ok?(H(null),e.isActive?(n(`public`),window.location.reload()):(T(r.warning?r.warning:r.purged?`已删除「${e.name}」及其数据`:`已从列表移除「${e.name}」(数据保留在磁盘)`),await Y(!1))):C(r.error||`删除失败`)}async function Be(){d(`discover`),C(``),T(``),K([]);let e=await y();if(d(null),!e.ok){C(e.error||`扫描失败`);return}let t=e.added?.length??0,n=e.backfilled?.length??0,r=e.skipped?.length??0,i=e.candidates??[],a=[];t?a.push(g(`space.discoverAdded`,{n:t})):i.length||a.push(g(`space.discoverNone`)),n&&a.push(g(`space.discoverBackfilled`,{n})),r&&a.push(g(`space.discoverSkipped`,{n:r})),T(a.join(`;`)),K(i),q(Object.fromEntries(i.map(e=>[e.path,e.hasContent===!0]))),await Y(!1)}async function Ve(){let e=G.filter(e=>Te[e.path]).map(e=>e.path);if(!e.length){K([]),T(g(`space.candidatesIgnored`));return}d(`discover`),C(``);let t=await y(e);if(d(null),!t.ok){C(t.error||`纳入失败`);return}K([]);let n=t.added?.length??0,r=t.skipped??[],i=[n?g(`space.candidatesAdopted`,{n}):g(`space.candidatesIgnored`)];r.length&&i.push(g(`space.candidatesRejected`,{names:r.map(e=>e.reason).join(`、`)})),T(i.join(`;`)),await Y(!1)}async function He(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;d(`import`),C(``);let n=await de(t);d(null),n.ok?(T(`已导入为「${n.space?.name}」`),await Y(!1)):C(n.error||`导入失败`)}let Z=l?.spaces??[],Ue=new Map(Z.map((e,t)=>[e.id,t])),We=e=>e.isPublic?0:e.isActive?1:2,Ge=[...Z].sort((e,t)=>We(e)-We(t)||(Ue.get(e.id)??0)-(Ue.get(t.id)??0)),Q=l?.baseRoot,$=u!==null,Ke=ke===`create`,qe=ke===`edit`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(o,{open:e,onClose:t,transition:!0,className:`relative z-95`,children:[(0,S.jsx)(s,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,S.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,S.jsxs)(i,{transition:!0,className:`tw-dialog-panel-anim tw-space-dialog w-full max-w-4xl rounded-xl shadow-xl border border-stone-200 bg-white flex flex-col h-[86vh]`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-5 pt-4 pb-3 border-b border-stone-200`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(a,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:g(`space.manageTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-stone-500 leading-relaxed`,children:g(`space.manageDesc`)})]}),(0,S.jsx)(`div`,{className:`shrink-0 flex items-center gap-2`,children:(0,S.jsx)(`button`,{type:`button`,onClick:t,className:`tw-confirm-cancel w-7 h-7 flex items-center justify-center rounded-md text-stone-400 hover:bg-stone-100 hover:text-stone-700 transition-colors`,"aria-label":`关闭`,children:`✕`})})]}),(0,S.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-5 py-4`,children:[v?(0,S.jsxs)(`div`,{className:`mb-3 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 flex items-start gap-2`,children:[(0,S.jsx)(`span`,{className:`flex-1 min-w-0`,children:v}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>C(``),className:`shrink-0 w-5 h-5 -mr-0.5 flex items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,"aria-label":`关闭`,children:`✕`})]}):null,w?(0,S.jsxs)(`div`,{className:`mb-3 rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-700 flex items-start gap-2`,children:[(0,S.jsx)(`span`,{className:`flex-1 min-w-0`,children:w}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>T(``),className:`shrink-0 w-5 h-5 -mr-0.5 flex items-center justify-center rounded text-emerald-700/70 hover:bg-emerald-100 hover:text-emerald-900`,"aria-label":`关闭`,children:`✕`})]}):null,G.length?(0,S.jsxs)(`div`,{className:`mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-amber-800`,children:g(`space.candidatesTitle`,{n:G.length})}),(0,S.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug text-amber-700/90`,children:g(`space.candidatesHint`)}),(0,S.jsx)(`div`,{className:`mt-2 max-h-44 overflow-auto rounded-md border border-amber-200/70 bg-white divide-y divide-stone-100`,children:G.map(e=>(0,S.jsxs)(`label`,{className:`flex items-start gap-2 px-2.5 py-1.5 cursor-pointer hover:bg-stone-50`,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:Te[e.path]===!0,onChange:t=>q(n=>({...n,[e.path]:t.target.checked})),className:`mt-0.5 accent-[#4176e6]`}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block text-xs text-stone-800 truncate`,children:e.name}),(0,S.jsx)(`span`,{className:`block text-[10px] text-stone-400 truncate font-mono`,children:Q?b(e.path,Q):e.path})]})]},e.path))}),(0,S.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>q(Object.fromEntries(G.map(e=>[e.path,!0]))),className:`text-[11px] text-[#4176e6] hover:underline`,children:g(`space.candidatesSelectAll`)}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>q({}),className:`text-[11px] text-stone-500 hover:underline`,children:g(`space.candidatesClear`)}),(0,S.jsx)(`span`,{className:`flex-1`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>{K([]),q({}),T(g(`space.candidatesIgnored`))},className:`px-2.5 py-1 text-[11px] rounded-md border border-stone-200 text-stone-600 hover:bg-stone-50`,children:g(`space.candidatesIgnore`)}),(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Ve(),className:`px-2.5 py-1 text-[11px] rounded-md bg-[#4176e6] text-white hover:bg-[#3565c7] disabled:opacity-40`,children:g(`space.candidatesAdopt`)})]})]}):null,E?(0,S.jsxs)(`div`,{ref:De,children:[(0,S.jsxs)(`div`,{className:`mb-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:g(`space.newTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400`,children:g(`space.newDesc`)})]}),(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`input`,{autoFocus:!0,value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Pe())},placeholder:g(`space.namePlaceholder`),className:`w-full h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors`})}),l?(0,S.jsx)(`div`,{className:`mt-1.5 text-[11px] text-stone-400 truncate`,children:(0,S.jsx)(`code`,{children:b(l.dataRoot,l.baseRoot)})}):null,(0,S.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:g(`space.promptBriefLabel`)}),(0,S.jsx)(ge,{value:A,onChange:ve,onGenerate:()=>void Me(`create`),onStop:X,generating:Ke,disabled:$}),(0,S.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,S.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:g(`space.promptHint`)}),Ke?(0,S.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[g(`space.promptGeneratingStatus`),(0,S.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,S.jsx)(_e,{value:ye,onChange:j,disabled:$})]})]}):M?(0,S.jsxs)(`div`,{ref:Oe,children:[(0,S.jsxs)(`div`,{className:`mb-2`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-stone-500`,children:g(`space.editTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-stone-400 font-mono truncate`,children:Q?b(M.path,Q):M.path})]}),(0,S.jsxs)(`label`,{className:`block text-xs font-medium text-stone-500`,children:[g(`space.nameLabel`),(0,S.jsx)(`input`,{autoFocus:!0,value:P,disabled:z||M.isPublic===!0,onChange:e=>F(e.target.value),className:`mt-1.5 w-full h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors disabled:bg-stone-50 disabled:text-stone-400`})]}),M.isPublic?(0,S.jsx)(`p`,{className:`mt-1 text-[11px] text-stone-400`,children:g(`space.publicNameLocked`)}):null,(0,S.jsxs)(`div`,{className:`mt-4 pt-3 border-t border-stone-200`,children:[(0,S.jsx)(`div`,{className:`text-xs font-medium text-stone-500 mb-1.5`,children:g(`space.promptBriefLabel`)}),(0,S.jsx)(ge,{value:I,onChange:e=>{L(e),B(!1)},onGenerate:()=>void Me(`edit`),onStop:X,generating:qe,disabled:$||z}),(0,S.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-3`,children:[(0,S.jsx)(`p`,{className:`flex-1 min-w-0 text-[11px] text-stone-400 leading-snug`,children:g(`space.promptBriefHint`)}),qe?(0,S.jsxs)(`p`,{className:`tw-busy-status shrink-0`,"aria-live":`polite`,children:[g(`space.promptGeneratingStatus`),(0,S.jsx)(`span`,{className:`tw-busy-ellipsis`,"aria-hidden":!0})]}):null]}),(0,S.jsx)(_e,{value:be,onChange:R,disabled:$||z,hint:g(`space.promptEditHint`)}),z?(0,S.jsx)(`p`,{className:`mt-2 text-[11px] text-stone-400`,children:g(`space.loading`)}):null]})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,S.jsxs)(`div`,{className:`text-xs font-medium text-stone-500`,children:[g(`space.listTitle`),Z.length?(0,S.jsx)(`span`,{className:`ml-1.5 text-[11px] text-stone-400 tabular-nums`,children:Z.length}):null]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>Ee.current?.click(),className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:u===`import`?`…`:g(`space.import`)}),(0,S.jsx)(`input`,{ref:Ee,type:`file`,accept:`.zip,application/zip`,className:`hidden`,onChange:e=>void He(e)}),(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Be(),"data-hint":g(`space.discoverTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:g(u===`discover`?`space.discovering`:`space.discover`)}),(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Y(!0),"data-hint":g(`space.sizeTitle`),"data-hint-always":``,className:`text-xs text-[#4176e6] hover:underline disabled:opacity-40`,children:g(u===`stats`?`space.sizing`:`space.size`)})]})]}),(0,S.jsx)(`div`,{className:`rounded-lg border border-stone-200 divide-y divide-stone-100 overflow-hidden`,children:Z.length===0?(0,S.jsx)(`div`,{className:`px-3 py-8 text-center text-xs text-stone-400`,children:g(`space.empty`)}):Ge.map(e=>(0,S.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-stone-800 truncate`,children:_(e)}),e.isPublic?(0,S.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500`,children:g(`space.builtin`)}):null,e.isActive?(0,S.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-[#4176e6]/10 text-[#3565c7]`,children:g(`space.activeTag`)}):null,e.exists?null:(0,S.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-amber-50 text-amber-600`,children:g(`space.missing`)}),e.bytes==null?null:(0,S.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-px text-[10px] bg-stone-100 text-stone-500 tabular-nums`,children:ie(e.bytes)})]}),(0,S.jsx)(`div`,{className:`mt-0.5 text-[11px] text-stone-400 truncate cursor-help hover:text-stone-500`,"data-hint":Q?b(e.path,Q):e.path,"data-hint-always":``,children:Q?b(e.path,Q):e.path})]}),(0,S.jsxs)(`div`,{className:`shrink-0 flex flex-wrap justify-end items-center gap-1`,children:[!e.isActive&&e.exists?(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>void Le(e),className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:g(`space.switch`)}):null,(0,S.jsx)(`button`,{type:`button`,disabled:$||!e.exists,onClick:()=>void Fe(e),className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:g(`space.edit`)}),(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{W(e),we(`${e.name}-copy`)},className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors`,children:g(`space.copy`)}),(0,S.jsx)(`a`,{href:le(e.id,`content`),"data-hint":g(`space.exportContentTitle`),"data-hint-always":``,className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 inline-flex items-center transition-colors`,children:g(`space.exportContent`)}),(0,S.jsx)(`a`,{href:le(e.id,`full`),"data-hint":g(`space.exportFullTitle`),"data-hint-always":``,className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 inline-flex items-center transition-colors`,children:g(`space.exportFull`)}),(0,S.jsx)(he,{hint:e.removable?void 0:g(`space.publicLocked`),children:(0,S.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>H({kind:`remove`,space:e}),className:`h-7 px-2 text-xs rounded-md border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none transition-colors`,children:g(`space.removeList`)})}),(0,S.jsx)(he,{hint:e.removable?void 0:g(`space.publicLocked`),children:(0,S.jsx)(`button`,{type:`button`,disabled:!e.removable||$,onClick:()=>H({kind:`delete`,space:e}),className:`h-7 px-2 text-xs rounded-md border border-red-200 text-red-600 hover:bg-red-50 disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none transition-colors`,children:g(`space.deleteDisk`)})})]})]},e.id))})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-3 border-t border-stone-200`,children:[(0,S.jsx)(`button`,{type:`button`,disabled:$||E||M!==null,onClick:()=>{!E&&M===null&&Ne()},className:`h-8 px-3 text-xs font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-[#4176e6] transition-colors`,children:g(`space.addNew`)}),(0,S.jsx)(`span`,{className:`flex-1`}),E||M?(0,S.jsx)(`button`,{type:`button`,disabled:$,onClick:()=>{X(),D(!1),N(null)},className:`tw-confirm-cancel h-8 px-4 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 disabled:opacity-40 transition-colors`,children:g(`space.cancel`)}):null,E?(0,S.jsx)(`button`,{type:`button`,disabled:!O.trim()||$,onClick:()=>void Pe(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`create`?`…`:g(`space.create`)}):M?(0,S.jsx)(`button`,{type:`button`,disabled:!P.trim()||$||z,onClick:()=>void Ie(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`update`?`…`:g(`space.save`)}):null]})]})})]}),(0,S.jsxs)(o,{open:U!==null,onClose:()=>W(null),transition:!0,className:`relative z-96`,children:[(0,S.jsx)(s,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/30`,"aria-hidden":`true`}),(0,S.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,children:(0,S.jsxs)(i,{transition:!0,className:`tw-confirm-dialog tw-dialog-panel-anim w-full max-w-sm rounded-xl shadow-xl border border-stone-200 p-5 bg-white`,children:[(0,S.jsx)(a,{className:`tw-confirm-title text-base font-semibold text-stone-900`,children:g(`space.confirmCopyTitle`)}),(0,S.jsx)(`p`,{className:`tw-confirm-msg mt-3 text-sm text-stone-600 leading-relaxed`,children:g(`space.confirmCopyMsg`,{name:U?.name??``})}),(0,S.jsxs)(`label`,{className:`mt-3 block text-xs font-medium text-stone-500`,children:[g(`space.copyName`),(0,S.jsx)(`input`,{autoFocus:!0,value:Ce,onChange:e=>we(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Re())},className:`mt-1.5 w-full h-9 px-3 text-sm rounded-lg border border-stone-200 text-stone-800 outline-none focus:ring-2 focus:ring-[#4176e6]/30 focus:border-[#4176e6] transition-colors`})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>W(null),className:`tw-confirm-cancel h-8 px-3 text-sm rounded-lg border border-stone-200 text-stone-600 hover:bg-stone-100 transition-colors`,children:g(`space.cancel`)}),(0,S.jsx)(`button`,{type:`button`,disabled:!Ce.trim()||$,onClick:()=>void Re(),className:`h-8 px-4 text-sm font-medium text-white bg-[#4176e6] rounded-lg hover:bg-[#3565c7] disabled:opacity-40 transition-colors`,children:u===`copy`?`…`:g(`space.copy`)})]})]})})]}),(0,S.jsx)(f,{open:V?.kind===`remove`,title:g(`space.confirmRemoveTitle`),message:V?.kind===`remove`?g(`space.confirmRemoveMsg`,{name:V.space.name,path:V.space.path}):``,confirmLabel:g(`space.removeList`),onClose:()=>H(null),onConfirm:()=>{V?.kind===`remove`&&ze(V.space,!1)}}),(0,S.jsx)(f,{open:V?.kind===`delete`,title:g(`space.confirmDeleteTitle`),message:V?.kind===`delete`?g(`space.confirmDeleteMsg`,{name:V.space.name,path:V.space.path}):``,confirmLabel:g(`space.deleteDisk`),danger:`solid`,onClose:()=>H(null),onConfirm:()=>{V?.kind===`delete`&&ze(V.space,!0)}})]})}var w=`tw.spaces.list.v1`;function T(){try{let e=sessionStorage.getItem(w);if(!e)return null;let t=JSON.parse(e);return t&&Array.isArray(t.spaces)?t:null}catch{return null}}function E(e){try{sessionStorage.setItem(w,JSON.stringify(e))}catch{}}function D(e){try{e?document.documentElement.dataset.spaceService=`none`:delete document.documentElement.dataset.spaceService}catch{}}function O(){let e=T(),[t,n]=(0,x.useState)(e!==null),[r,i]=(0,x.useState)(e!==null),[a,o]=(0,x.useState)(e),[s,d]=(0,x.useState)(!1),[f,p]=(0,x.useState)(!1),[m,h]=(0,x.useState)(``);(0,x.useEffect)(()=>{let e=!0;return(async()=>{let t=await v();if(!e)return;if(i(!0),!t){n(!1),D(!0);return}D(!1),n(!0);let r=await re();e&&r&&(o(r),E(r))})(),()=>{e=!1}},[]);async function te(e){if(e===a?.activeId)return;p(!0),h(``);let t=await se(e);t.ok?(a&&E({...a,activeId:e,spaces:a.spaces.map(t=>({...t,isActive:t.id===e}))}),window.location.reload()):(p(!1),h(t.error||`切换失败`))}if(!r)return null;if(!t)return(0,S.jsx)(`div`,{className:`tw-nav-space`,children:(0,S.jsxs)(`div`,{className:`tw-nav-space-btn tw-nav-space-btn--off`,children:[(0,S.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,S.jsx)(k,{})}),(0,S.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,S.jsx)(`span`,{className:`tw-nav-space-cap`,children:g(`space.offlineCap`)}),(0,S.jsx)(`span`,{className:`tw-nav-space-name`,children:g(`space.offline`)})]})]})});let ne=a?.spaces.find(e=>e.isActive),y=(a?.spaces??[]).filter(e=>!e.isActive);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`tw-nav-space`,children:(0,S.jsxs)(ee,{as:`div`,className:`tw-nav-space-menu`,children:[(0,S.jsxs)(u,{className:`tw-nav-space-btn`,"data-hint":g(`space.label`),children:[(0,S.jsx)(`span`,{className:`tw-nav-space-ico`,"aria-hidden":`true`,children:(0,S.jsx)(k,{})}),(0,S.jsxs)(`span`,{className:`tw-nav-space-text`,children:[(0,S.jsx)(`span`,{className:`tw-nav-space-cap`,children:g(`space.current`)}),(0,S.jsx)(`span`,{className:`tw-nav-space-name`,children:f?g(`space.switching`):ne?_(ne):`—`})]}),(0,S.jsx)(`svg`,{className:`tw-nav-space-caret`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,S.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),(0,S.jsxs)(c,{transition:!0,anchor:{to:`bottom start`,gap:`0.375rem`},className:`tw-nav-space-pop tw-menu-anim`,children:[m?(0,S.jsx)(`div`,{className:`tw-nav-space-err`,role:`alert`,children:m}):null,(0,S.jsx)(`div`,{className:`tw-nav-space-group`,children:g(`space.others`)}),y.length===0?(0,S.jsx)(`p`,{className:`tw-nav-space-hint`,children:g(`space.othersEmpty`)}):y.map(e=>(0,S.jsx)(l,{children:(0,S.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item`,disabled:f,onClick:()=>void te(e.id),children:[(0,S.jsx)(`span`,{className:`tw-nav-space-item-main`,children:(0,S.jsx)(`span`,{className:`tw-nav-space-item-name`,"data-hint":_(e),children:_(e)})}),(0,S.jsx)(`svg`,{className:`tw-nav-space-item-go`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,S.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})},e.id)),(0,S.jsx)(`div`,{className:`tw-nav-space-sep`}),(0,S.jsx)(l,{children:(0,S.jsxs)(`button`,{type:`button`,className:`tw-nav-space-item tw-nav-space-item--manage`,onClick:()=>d(!0),children:[(0,S.jsx)(`span`,{className:`tw-nav-space-item-ico`,"aria-hidden":`true`,children:(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,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`,{className:`tw-nav-space-item-main`,children:(0,S.jsx)(`span`,{className:`tw-nav-space-item-name`,children:g(`space.manage`)})}),(0,S.jsx)(`svg`,{className:`tw-nav-space-item-go`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,S.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})})]})]})}),(0,S.jsx)(C,{open:s,onClose:()=>d(!1),onListChanged:e=>{o(e),E(e)}})]})}function k(){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`path`,{d:`M3 7.5 12 3l9 4.5-9 4.5-9-4.5Z`}),(0,S.jsx)(`path`,{d:`m3 12.5 9 4.5 9-4.5`}),(0,S.jsx)(`path`,{d:`m3 17 9 4.5 9-4.5`})]})}export{O as default};
@@ -1 +0,0 @@
1
- var e=[{id:`functional`,label:`功能测试`,casesFolder:`功能测试`,templateFolder:`功能测试用例`},{id:`api`,label:`接口测试`,casesFolder:`接口测试`,templateFolder:`接口测试用例`},{id:`performance`,label:`性能测试`,casesFolder:`性能测试`,templateFolder:`性能测试用例`},{id:`automation`,label:`自动化测试`,casesFolder:`自动化测试`,templateFolder:`自动化测试用例`}];function t(){return`ct_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function n(e){let t=e.trim()||`未命名类型`;return{casesFolder:t,templateFolder:`${t}用例`}}function r(e){if(!e||typeof e!=`object`)return null;let r=e,i=String(r.label??``).trim();if(!i)return null;let a=String(r.id??``).trim()||t(),o=n(i);return{id:a,label:i,casesFolder:typeof r.casesFolder==`string`&&r.casesFolder.trim()?r.casesFolder.trim():o.casesFolder,templateFolder:typeof r.templateFolder==`string`&&r.templateFolder.trim()?r.templateFolder.trim():o.templateFolder}}function i(t){if(!Array.isArray(t))return e.map(e=>({...e}));let n=[],i=new Set;for(let e of t){let t=r(e);t&&!i.has(t.id)&&(i.add(t.id),n.push(t))}return n.length?n:e.map(e=>({...e}))}function a(){return t()}var o=[`测试规范`,`方法论`,`环境约定`];function s(e){if(!Array.isArray(e))return[...o];let t=[],n=new Set;for(let r of e){let e=String(r??``).trim();!e||e.length>40||n.has(e)||(n.add(e),t.push(e))}return t.length?t:[...o]}var c=[{id:`case`,label:`用例生成提示词`,hint:`用于编写「用例生成」提示词:指导模型按需求与模板输出可入库用例;须约束 JSON 结构、字段对齐模板、步骤换行与覆盖策略,不要限定固定用例条数。`},{id:`general`,label:`通用提示词`,hint:`用于编写通用测试/工作台提示词:角色、输出风格与约束清晰,可直接作为系统或任务提示词使用。`}];function l(){return`pk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function u(e){return`生成「${e.trim()||`自定义`}」类提示词:角色、输出风格与约束清晰,可直接作为系统或任务提示词使用。`}function d(e){if(!e||typeof e!=`object`)return null;let t=e,n=String(t.label??``).trim();if(!n)return null;let r=String(t.id??``).trim()||l(),i=typeof t.hint==`string`&&t.hint.trim()?t.hint.trim():u(n);return r===`case`&&i.includes(`「测试用例生成」`)&&(i=c[0].hint),{id:r,label:n,hint:i}}function f(e){if(!Array.isArray(e))return c.map(e=>({...e}));let t=[],n=new Set;for(let r of e){let e=d(r);e&&!n.has(e.id)&&(n.add(e.id),t.push(e))}return t.length?t:c.map(e=>({...e}))}function p(){return l()}var m=[{id:`dashboard`,href:`dashboard/`,i18n:`nav.dashboard`,plugin:`dashboard`,match:`dashboard`},{id:`tasks`,href:`tasks/`,i18n:`nav.tasks`,plugin:`tasks`,match:`tasks`},{id:`todos`,href:`todos/`,i18n:`nav.todos`,plugin:`todos`,match:`todos`},{id:`projects`,href:`pm/projects/`,i18n:`nav.projects`,plugin:`projects`,match:`pm/projects`},{id:`iterations`,href:`pm/iterations/`,i18n:`nav.iterations`,plugin:`iterations`,match:`pm/iterations`},{id:`pmRequirements`,href:`pm/requirements/`,i18n:`nav.requirementsMgmt`,plugin:`pmRequirements`,match:`pm/requirements`},{id:`bugs`,href:`pm/bugs/`,i18n:`nav.bugs`,plugin:`bugs`,match:`pm/bugs`},{id:`reports`,href:`reports/`,i18n:`nav.reports`,plugin:`reports`,match:`reports`},{id:`testStats`,href:`test-stats/`,i18n:`nav.testStats`,plugin:`testStats`,match:`test-stats`},{id:`caseExec`,href:`case-exec/`,i18n:`nav.caseExec`,plugin:`caseExec`,match:`case-exec`},{id:`cases`,href:`cases/library/`,i18n:`nav.caseManage`,plugin:`cases`,match:`cases`},{id:`prompts`,href:`prompts/`,i18n:`nav.prompts`,plugin:`prompts`,match:`prompts`},{id:`knowledgeLib`,href:`knowledge/`,i18n:`nav.knowledge`,plugin:`knowledgeLib`,match:`knowledge`},{id:`requirements`,href:`requirements/`,i18n:`nav.requirements`,plugin:`requirements`,match:`requirements`},{id:`templates`,href:`templates/`,i18n:`nav.templates`,plugin:`templates`,match:`templates`}],h=[],ee=[`prompts`];function g(e){return ee.includes(e)}var _=[`check`,`pencil`,`book`,`fileText`,`layers`,`list`,`folder`,`star`,`database`,`target`,`code`,`flask`,`home`,`clipboard`,`bug`,`calendar`,`chart`,`globe`,`link`,`users`,`terminal`,`tag`,`flag`,`zap`,`dashboard`],v={dashboard:`dashboard`,tasks:`clipboard`,todos:`list`,projects:`folder`,iterations:`calendar`,pmRequirements:`fileText`,bugs:`bug`,reports:`fileText`,testStats:`chart`,caseExec:`target`,cases:`check`,prompts:`pencil`,knowledgeLib:`book`,requirements:`fileText`,templates:`layers`};function te(e){return typeof e==`string`&&_.includes(e)}function y(e){let t={...v};if(!e||typeof e!=`object`||Array.isArray(e))return t;for(let n of m){let r=e[n.id];te(r)&&(t[n.id]=r)}return t}var ne=new Set(m.map(e=>e.id));function b(e){return typeof e==`string`&&ne.has(e)}function re(e){return m.find(t=>t.id===e)}function x(e){return`item:${e}`}function S(e){return`group:${e}`}function C(){return`ng_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function ie(){return h.map(e=>({id:e.id,name:e.name,items:[...e.items]}))}function w(e,t=!0){if(e==null||!Array.isArray(e))return t?ie():[];let n=new Set,r=[],i=new Set;for(let t of e){if(!t||typeof t!=`object`)continue;let e=t,a=String(e.name??``).trim();if(!a)continue;let o=String(e.id??``).trim()||C();i.has(o)&&(o=C());let s=[];if(Array.isArray(e.items))for(let t of e.items)b(t)&&!n.has(t)&&(n.add(t),s.push(t));let c=String(e.parentId??``).trim()||void 0;i.add(o),r.push({id:o,name:a,items:s,parentId:c})}let a=new Set(r.map(e=>e.id)),o=r.map(e=>{let t=e.parentId;return(!t||t===e.id||!a.has(t))&&(t=void 0),t?{...e,parentId:t}:{id:e.id,name:e.name,items:e.items}}),s=new Map(o.map(e=>[e.id,e])),c=o.map(e=>{if(!e.parentId)return e;let t=s.get(e.parentId);if(t?.parentId){let n=t.parentId;return n&&n!==e.id&&a.has(n)?{...e,parentId:n}:{id:e.id,name:e.name,items:e.items}}return e}),l=new Set(c.map(e=>e.parentId).filter(e=>!!e));return c.filter(e=>e.items.length>0||l.has(e.id))}function T(e,t){let n=t.name.trim(),r=t.items.filter((e,t,n)=>b(e)&&n.indexOf(e)===t);if(!n||!r.length)return{groups:e,id:t.id?.trim()||``};let i=t.id?.trim()||C(),a=e.find(e=>e.id===i),o=t.parentId===void 0?a?.parentId:t.parentId.trim()||void 0;if(o===i&&(o=void 0),o){let t=e.find(e=>e.id===o);t?t.parentId&&(o=t.parentId):o=void 0}let s=new Set(r),c=e.filter(e=>e.id!==i).map(e=>({...e,items:e.items.filter(e=>!s.has(e))}));return c.push(o?{id:i,name:n,items:r,parentId:o}:{id:i,name:n,items:r}),{groups:w(c),id:i}}function ae(e,t){return e.filter(e=>e.parentId===t).map(e=>e.id)}function E(e,t){return e.filter(e=>e.parentId===t)}function oe(e,t){let n=e.find(e=>e.id===t);if(!n)return e;let r=e.filter(e=>e.id!==t);return n.parentId?r.map(e=>e.id===n.parentId?{...e,items:[...e.items,...n.items]}:e.parentId===t?{...e,parentId:n.parentId}:e):r.map(e=>e.parentId===t?{id:e.id,name:e.name,items:e.items}:e)}function se(e,t,n){let r=e.find(e=>e.id===t);return!r||!b(n)||r.items.includes(n)?e:T(e,{id:r.id,name:r.name,items:[...r.items,n]}).groups}function ce(e,t){let n=e.find(e=>e.items.includes(t))??null;return n?{groups:e.map(e=>e.id===n.id?{...e,items:e.items.filter(e=>e!==t)}:e).filter(e=>e.items.length>0),owner:n}:{groups:e,owner:null}}function le(e,t,n,r){let i=x(t),a=S(n.id),o=r.some(e=>e.id===n.id),s=e.indexOf(a),c=e.filter(e=>e!==i&&(o||e!==a)),l=s<0?c.length:o?s+1:s;return c.splice(l,0,i),O(c,r)}function ue(e){let t=new Map(e.map(e=>[e.id,e])),n=new Map;for(let r of e){let e=r.parentId?t.get(r.parentId)??r:r;for(let t of r.items)n.set(t,e)}let r=new Set,i=[];for(let e of m){let t=n.get(e.id);if(t){if(r.has(t.id))continue;r.add(t.id),i.push({type:`group`,group:t})}else i.push({type:`item`,id:e.id})}return i}function D(e){let t=new Map;for(let n of e){if(!n.parentId)continue;let e=t.get(n.parentId);e?e.push(n):t.set(n.parentId,[n])}let n=[],r=new Set,i=e=>{if(!r.has(e.id)){r.add(e.id),n.push(S(e.id));for(let n of t.get(e.id)??[])i(n)}};for(let t of ue(e))t.type===`item`?n.push(x(t.id)):i(t.group);for(let t of e)i(t);return n}function de(e){let t=new Set,n=new Set;for(let r of e){n.add(S(r.id));for(let e of r.items)t.add(e)}for(let e of m)t.has(e.id)||n.add(x(e.id));return n}function O(e,t){let n=de(t),r=[],i=new Set;if(Array.isArray(e))for(let t of e)typeof t==`string`&&n.has(t)&&!i.has(t)&&(i.add(t),r.push(t));for(let e of D(t))i.has(e)||r.push(e);return r}function k(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Set(e.flatMap(e=>e.items)),i=O(t,e),a=[];for(let e of i)if(e.startsWith(`group:`)){let t=n.get(e.slice(6));t&&!t.parentId&&a.push({type:`group`,group:t})}else if(e.startsWith(`item:`)){let t=e.slice(5);b(t)&&!r.has(t)&&a.push({type:`item`,id:t})}return a}function A(e,t,n){let r=t.find(e=>e.id===n);if(!r)return O(e,t);let i=new Set(r.items.map(e=>x(e))),a=S(n);if(r.parentId){let n=e.filter(e=>e!==a),i=S(r.parentId),o=n.indexOf(i),s=[...n];return o<0?s.push(a):s.splice(o+1,0,a),O(s,t)}let o=[...e],s=o.length;for(let e=0;e<o.length;e++){let t=o[e];if(t===a||i.has(t)){s=o.slice(0,e).filter(e=>e!==a&&!i.has(e)).length;break}}let c=o.filter(e=>e!==a&&!i.has(e));return c.splice(s,0,a),O(c,t)}function fe(e,t,n){let r=E(e,t);if(!n?.length||r.length<2)return r;let i=new Map;return n.forEach((e,t)=>{i.has(e)||i.set(e,t)}),r.map((e,t)=>({group:e,i:t,at:i.get(S(e.id))})).sort((e,t)=>{let n=e.at??1/0,r=t.at??1/0;return n===r?e.i-t.i:n-r}).map(e=>e.group)}function pe(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=r.filter(e=>i.get(e)?.parentId===n),o=new Set(a.map(S)),s=e.filter(e=>!o.has(e)),c=S(n),l=s.indexOf(c),u=a.map(S),d=[...s];return l<0?d.push(...u):d.splice(l+1,0,...u),O(d,t)}function me(e,t){if(!e.startsWith(`group:`))return!1;let n=e.slice(6);return t.some(e=>e.id===n&&!!e.parentId)}function he(e,t,n,r=[]){if(t.parentId)return O(e,n);let i=S(t.id),a=[...r.map(e=>S(e)),...t.items.map(e=>x(e))],o=e.filter(e=>e!==i);return o.push(...a),O(o,n)}function ge(e,t,n){let r=e.indexOf(t),i=e.indexOf(n);if(r<0||i<0||r===i)return[...e];let a=[...e],[o]=a.splice(r,1);return o===void 0?[...e]:(a.splice(i,0,o),a)}var j=`tw.space.active-id`,_e=`tw.spaces.list.v1`;function M(e,t){try{return(e===`local`?localStorage:sessionStorage).getItem(t)?.trim()||``}catch{return``}}function N(e,t,n){try{(e===`local`?localStorage:sessionStorage).setItem(t,n)}catch{}}function P(e){let t=String(e||``).trim();t&&(N(`session`,j,t),N(`local`,j,t))}function F(){let e=M(`session`,j);if(e)return e;let t=M(`local`,j);if(t)return t;try{let e=sessionStorage.getItem(_e);if(!e)return``;let t=JSON.parse(e);return String(t?.activeId||``).trim()}catch{return``}}function I(e){let t=F();return t?`${e}::${t}`:e}var L=`/__tb_config`,R=`tw.app.config.v1`,z=`tw.app.apikey.v1`,B=`tw.app.model.v1`,V=!1,H=null,U=``,W=!1,ve={language:`zh-CN`,appearance:`system`,sessionFontSize:14,toolStepDetail:`standard`,busySendBehavior:`queue`,subagentModel:``};function G(){return`p_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function ye(e){if(!e||typeof e!=`object`)return null;let t=String(e.name??``).trim()||`未命名提供商`,n=String(e.baseURL??``).trim(),r=String(e.model??``).trim();return{id:String(e.id??``).trim()||G(),name:t,baseURL:n,model:r,apiKey:typeof e.apiKey==`string`&&e.apiKey.trim()?e.apiKey.trim():void 0,availableModels:Array.isArray(e.availableModels)?e.availableModels.filter(e=>typeof e==`string`):void 0}}function be(e){let t=typeof e.baseURL==`string`?e.baseURL.trim():``,n=typeof e.model==`string`?e.model.trim():``;return!t&&!n&&!e.apiKey?[]:[{id:G(),name:`默认`,baseURL:t||`https://api.deepseek.com/v1`,model:n,apiKey:typeof e.apiKey==`string`&&e.apiKey.trim()?e.apiKey.trim():void 0,availableModels:Array.isArray(e.availableModels)?e.availableModels.filter(e=>typeof e==`string`):void 0}]}function K(e){let t=e?.reasoningEffort===`low`||e?.reasoningEffort===`high`||e?.reasoningEffort===`max`?e.reasoningEffort:`high`,n=[];Array.isArray(e?.providers)&&e.providers.length?n=e.providers.map(e=>ye(e)).filter(e=>!!e):e&&(e.baseURL||e.model||e.apiKey)&&(n=be(e));let r=typeof e?.activeId==`string`?e.activeId:``;return n.length&&!n.some(e=>e.id===r)&&(r=n[0].id),n.length||(r=``),{activeId:r,reasoningEffort:t,providers:n}}function q(){return{version:1,model:{activeId:``,reasoningEffort:`high`,providers:[]},access:`readonly`,general:{...ve},plugins:{cases:!1,caseGen:!1,prompts:!0,promptGen:!1,knowledgeLib:!1,knowledgeGen:!1,requirements:!1,templates:!1,knowledge:!1,memory:!1,pluginDev:!1,todos:!1,tasks:!1,projects:!1,iterations:!1,pmRequirements:!1,bugs:!1,reports:!1,testStats:!1,caseExec:!1,dashboard:!1},caseTypes:e.map(e=>({...e})),promptKinds:c.map(e=>({...e})),knowledgeCategories:[...o],navGroups:h.map(e=>({...e,items:[...e.items]})),navIcons:{...v},navOrder:D(h)}}function J(e){let t=q();if(!e||typeof e!=`object`)return t;let n=e.general&&typeof e.general==`object`?e.general:{},r={...t.plugins,...e.plugins??{}},a=w(e.navGroups);return{version:typeof e.version==`number`?e.version:1,model:K(e.model),access:e.access===`readwrite`||e.access===`full`||e.access===`readonly`?e.access:`readonly`,general:{language:n.language===`en`?`en`:`zh-CN`,appearance:n.appearance===`light`||n.appearance===`dark`||n.appearance===`system`?n.appearance:`system`,sessionFontSize:typeof n.sessionFontSize==`number`&&n.sessionFontSize>=12&&n.sessionFontSize<=22?Math.round(n.sessionFontSize):14,toolStepDetail:n.toolStepDetail===`concise`||n.toolStepDetail===`standard`||n.toolStepDetail===`detailed`||n.toolStepDetail===`full`?n.toolStepDetail:`standard`,busySendBehavior:n.busySendBehavior===`interrupt`?`interrupt`:`queue`,subagentModel:typeof n.subagentModel==`string`?n.subagentModel.trim():``},plugins:r,caseTypes:i(e.caseTypes),promptKinds:f(e.promptKinds),knowledgeCategories:s(e.knowledgeCategories),navGroups:a,navIcons:y(e.navIcons),navOrder:O(e.navOrder,a)}}function xe(){try{let e=localStorage.getItem(B);if(e)return K(JSON.parse(e))}catch{}try{let e=localStorage.getItem(I(R));if(e){let t=JSON.parse(e);if(t?.model)return K(t.model)}}catch{}return null}function Se(e){try{localStorage.setItem(B,JSON.stringify(e))}catch{}}function Y(){try{let e=localStorage.getItem(I(R)),t=xe();if(!e)return t?J({...q(),model:t}):null;let n=J(JSON.parse(e));return t&&(n.model=t),n}catch{return null}}function X(e){try{let{model:t,...n}=e;localStorage.setItem(I(R),JSON.stringify(n)),Se(t)}catch{}}function Ce(){try{return localStorage.getItem(z)?.trim()||localStorage.getItem(I(z))?.trim()||``}catch{return``}}function we(e){try{e?localStorage.setItem(z,e):localStorage.removeItem(z),localStorage.removeItem(I(z))}catch{}}function Te(){try{let e=q(),t=!1,n=localStorage.getItem(`tw-llm-settings`);if(n){let r=JSON.parse(n);e.model=K({providers:[{id:G(),name:r.name||`默认`,baseURL:r.baseURL||``,model:r.model||``,apiKey:r.apiKey,availableModels:r.availableModels}],reasoningEffort:r.reasoningEffort}),e.model.providers[0]&&(e.model.activeId=e.model.providers[0].id),t=!0}let r=localStorage.getItem(`tw-access-level`);(r===`readonly`||r===`readwrite`||r===`full`)&&(e.access=r,t=!0);let i=localStorage.getItem(`tw.general.prefs.v1`);i&&(e.general=J({general:JSON.parse(i)}).general,t=!0);let a=localStorage.getItem(`tw.plugins.enabled.v1`);if(a){let n=JSON.parse(a);e.plugins={...e.plugins,...n},t=!0}return t?e:null}catch{return null}}function Z(e){let t=e.model.providers;return t.length?t.find(t=>t.id===e.model.activeId)??t[0]??null:null}function Ee(){return V}function De(){return H||Oe(),H??q()}function Oe(){if(!W&&(W=!0,typeof window<`u`))try{let e=Y();e&&(H=e)}catch{}}function ke(){return U}function Ae(){return[...H?.model.providers??[]]}async function je(){try{let e=await fetch(L,{signal:AbortSignal.timeout(2e3)});if(e.ok){let t=await e.json();H=J(t.config);let n=Z(H),r=String(t.apiKey??``).trim();return U=r||n?.apiKey?.trim()||``,r&&n&&!n.apiKey&&(U=r),V=!0,X(H),H}}catch{}V=!1;let e=Y();return e||=Te()??q(),H=e,U=Z(e)?.apiKey?.trim()||Ce(),X(H),H}var Q=null;async function $(e){if(X(e),V)try{await fetch(L,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({config:e})})}catch{}}function Me(e){let t=H??q(),n=J({...t,...e,model:e.model?{...t.model,...e.model,providers:e.model.providers??t.model.providers}:t.model,general:{...t.general,...e.general??{}},plugins:{...t.plugins,...e.plugins??{}},caseTypes:e.caseTypes??t.caseTypes,promptKinds:e.promptKinds??t.promptKinds,knowledgeCategories:e.knowledgeCategories??t.knowledgeCategories,navGroups:e.navGroups??t.navGroups,navIcons:e.navIcons??t.navIcons,navOrder:e.navOrder??t.navOrder});return H=n,U=Z(n)?.apiKey?.trim()||``,Q&&clearTimeout(Q),Q=setTimeout(()=>{Q=null,$(n)},280),n}function Ne(){return Q&&=(clearTimeout(Q),null),$(H??q())}function Pe(e){if(U=e.trim(),V||we(U),!H)return;let t=H.model.providers.map(e=>e.id===H.model.activeId?{...e,apiKey:U||void 0}:e);H=J({...H,model:{...H.model,providers:t}})}function Fe(){let e=H;if(!e)return null;let t=Z(e);if(!t?.baseURL?.trim()||!t.model?.trim())return null;let n=(t.apiKey||U).trim();return n?{baseURL:t.baseURL.trim(),apiKey:n,model:t.model.trim(),reasoningEffort:e.model.reasoningEffort,availableModels:t.availableModels}:null}function Ie(){return G()}export{le as A,p as B,g as C,y as D,w as E,oe as F,n as G,o as H,ge as I,a as K,T as L,A as M,fe as N,O,ce as P,c as R,me as S,E as T,s as U,f as V,e as W,se as _,Ee as a,re as b,Pe as c,F as d,P as f,_ as g,m as h,je as i,he as j,pe as k,Fe as l,v as m,ke as n,Ae as o,I as p,i as q,De as r,Ie as s,Ne as t,Me as u,k as v,x as w,S as x,ae as y,u as z};
@@ -1,7 +0,0 @@
1
- import{a as e}from"./react-dom.CqAxpHMt.js";import{s as t}from"./settings.CMK4PEak.js";var n=e({applyDomI18n:()=>o,t:()=>a}),r={"nav.home":`我的工作台`,"nav.dashboard":`仪表盘`,"nav.tasks":`任务管理`,"nav.todos":`待办事项`,"nav.projects":`项目列表`,"nav.iterations":`迭代管理`,"nav.requirementsMgmt":`需求管理`,"nav.bugs":`缺陷管理`,"nav.reports":`工作汇报`,"nav.testStats":`测试统计`,"nav.caseExec":`用例执行统计`,"nav.requirements":`需求文档库`,"nav.caseManage":`用例管理`,"nav.cases":`用例`,"nav.templates":`测试模板库`,"nav.docs":`文档库`,"nav.createGroup":`创建分组`,"nav.createSubgroup":`创建子分组`,"nav.assignGroup":`加入分组`,"nav.more":`更多操作`,"nav.groupActions":`分组操作`,"nav.addSubgroup":`添加子分组`,"nav.addToGroup":`添加到分组`,"nav.chooseIcon":`选择图标`,"nav.leaveGroup":`移出分组`,"nav.currentGroup":`当前`,"nav.noGroups":`还没有分组`,"nav.noAddableItems":`没有可添加的菜单项`,"nav.editGroup":`编辑`,"nav.editGroupTitle":`编辑分组`,"nav.sortMenu":`排序`,"nav.sortMenuTitle":`菜单排序`,"nav.sortHint":`按住拖动调整顺序`,"nav.subgroups":`子分组`,"nav.sortUp":`上移`,"nav.sortDown":`下移`,"nav.done":`完成`,"nav.deleteGroup":`取消分组`,"nav.deleteGroupMsg":`取消分组后,其中的菜单项会在菜单栏平铺显示。`,"nav.deleteSubgroupMsg":`取消子分组后,其中的菜单项会回到上级分组。`,"nav.groupName":`分组名称`,"nav.groupItems":`选择菜单项`,"nav.groupItemsHint":`已加入其他分组的菜单不会列出。`,"nav.groupNameRequired":`请填写分组名称`,"nav.groupItemsRequired":`请至少选择一项`,"nav.groupSave":`保存`,"nav.groupCancel":`取消`,"nav.prompts":`提示词管理`,"nav.knowledge":`知识库管理`,"nav.plugins":`我的插件`,"nav.brand":`Lantern Harness`,"nav.settings":`设置`,"nav.changelog":`变更日志`,"nav.changelogShort":`版本日志`,"nav.helpCenter":`帮助中心`,"docs.nav.title":`文档`,"docs.nav.changelog":`版本日志`,"docs.nav.manual":`操作手册`,"docs.nav.install":`安装手册`,"nav.repo":`GitHub 仓库`,"nav.repoShort":`仓库`,"nav.npm":`npm 包`,"nav.npmShort":`npm`,"nav.site":`炊烟小站`,"nav.siteShort":`小站`,"nav.board":`问题与建议`,"nav.boardShort":`问题与建议`,"space.label":`数据空间`,"space.current":`当前空间`,"space.switchTo":`切换到该空间`,"space.manage":`管理空间`,"space.others":`其他空间`,"space.manageTitle":`空间管理`,"space.manageDesc":`每个数据空间是一份相互隔离的数据目录:需求 / 用例 / 提示词 / 知识库 / 模板、会话与配置互不影响。`,"space.listTitle":`全部空间`,"space.newTitle":`新建空间`,"space.newDesc":`新建一份独立的数据目录;默认提示词会随空间一起创建,之后可在「提示词管理」继续修改。`,"space.addNew":`+ 新增空间`,"space.edit":`编辑`,"space.editTitle":`编辑空间`,"space.save":`保存`,"space.cancel":`取消`,"space.loading":`加载中…`,"space.detailFailed":`读取空间信息失败`,"space.updateFailed":`保存失败`,"space.updated":`已保存「{name}」`,"space.publicNameLocked":`公共空间名称不可修改`,"space.switch":`切换`,"space.nameLabel":`空间名称`,"space.namePlaceholder":`输入空间名称`,"space.create":`新建`,"space.promptBriefLabel":`提示词要求`,"space.promptBriefPlaceholder":`描述这个空间里的助手应怎样工作,Enter 或点发送生成提示词;Shift+Enter 换行`,"space.promptGenerate":`生成提示词`,"space.promptGenerating":`生成中…`,"space.promptGeneratingStatus":`正在生成提示词`,"space.promptStop":`停止生成`,"space.promptBodyLabel":`默认提示词`,"space.promptBodyPlaceholder":`将写入该空间的 默认提示词.md`,"space.promptHint":`创建后写入该空间的提示词管理,作为默认提示词。`,"space.promptBriefHint":`这段要求会随空间保存,便于之后重新生成提示词。`,"space.promptEditHint":`保存后覆盖该空间的 默认提示词.md,工作台会立即使用新提示词。`,"space.promptNeedReq":`请先填写提示词要求,再生成。`,"space.promptNeedBody":`请先填写默认提示词。`,"space.promptNeedModel":`请先在设置里配置可用的模型后再生成。`,"space.promptGenEmpty":`模型没有给出可用提示词,请重试或直接手写。`,"space.needName":`请先填写空间名称。`,"space.created":`已创建「{name}」`,"space.createdWithPrompt":`已创建「{name}」,默认提示词已写入该空间的提示词管理`,"space.name":`名称`,"space.location":`位置`,"space.size":`体积`,"space.sizeTitle":`统计各空间占用的磁盘大小`,"space.sizing":`统计中…`,"space.status":`状态`,"space.builtin":`默认`,"space.publicName":`公共空间`,"space.activeTag":`当前`,"space.missing":`目录不存在`,"space.rename":`重命名`,"space.copy":`复制`,"space.export":`导出`,"space.exportContent":`导出内容库`,"space.exportContentTitle":`不含密钥、会话、记忆与缓存,适合分享内容`,"space.exportFull":`导出备份`,"space.exportFullTitle":`含密钥、会话与全部本机状态,适合自己备份`,"space.discover":`扫描文件夹`,"space.discoverTitle":`扫描托管目录,纳入带 .lantern/space.json 清单的空间文件夹;其它文件夹列出来等你确认`,"space.discovering":`扫描中…`,"space.discoverAdded":`已纳入 {n} 个空间`,"space.discoverNone":`没有发现可纳入的空间文件夹`,"space.discoverBackfilled":`并为 {n} 个已有空间补写了 space.json 清单`,"space.discoverSkipped":`跳过 {n} 个(重名、名称非法或缺空间元数据)`,"space.candidatesTitle":`扫描到 {n} 个不是数据空间的文件夹,要纳入吗?`,"space.candidatesHint":`勾选后纳入列表;不会写入空间清单(.lantern/space.json),文件夹内容保持原样。`,"space.candidatesSelectAll":`全选`,"space.candidatesClear":`全不选`,"space.candidatesIgnore":`忽略`,"space.candidatesIgnored":`已忽略,未纳入任何文件夹`,"space.candidatesAdopt":`纳入所选`,"space.candidatesAdopted":`已纳入 {n} 个文件夹`,"space.candidatesRejected":`未纳入:{names}`,"space.removeList":`移出列表`,"space.deleteDisk":`删除数据`,"space.import":`导入`,"space.refresh":`刷新`,"space.empty":`还没有自定义空间,点「+ 新增空间」开始。`,"space.newParentHint":`新建的空间会落在:`,"space.switching":`正在切换…`,"space.reloadHint":`切换后页面会自动重载。`,"space.confirmRemoveTitle":`移出列表`,"space.confirmRemoveMsg":`将从列表中移除「{name}」,磁盘数据保留在:
2
- {path}
3
- 之后可在管理界面重新纳入。`,"space.confirmDeleteTitle":`删除数据`,"space.confirmDeleteMsg":`将永久删除「{name}」及其全部数据,无法恢复:
4
- {path}`,"space.confirmCopyTitle":`复制空间`,"space.confirmCopyMsg":`将复制「{name}」的全部内容到新空间,文件较多时可能耗时较久。`,"space.done":`完成`,"space.copyName":`副本名称`,"space.importPick":`选择要导入的 zip 备份`,"space.othersEmpty":`还没有其他空间。可点下方「管理空间」新建或导入。`,"space.busyRuns":`仍有会话在运行,请先停止后再切换空间。`,"space.publicLocked":`公共空间不支持重命名或删除。`,"space.offline":`工作区不可用`,"space.offlineCap":`未连接本地服务`,"settings.general":`通用设置`,"settings.model":`模型`,"settings.close":`关闭`,"settings.access":`权限`,"settings.accessDesc":`选择新会话的默认权限模式`,"settings.language":`语言`,"settings.appearance":`外观`,"settings.appear.light":`浅色`,"settings.appear.dark":`深色`,"settings.appear.system":`跟随系统`,"settings.fontSize":`字号大小`,"settings.fontSizeDesc":`调整正文与会话内容的字号(不影响侧栏布局)`,"settings.toolSteps":`工作步骤展示`,"settings.toolStepsDesc":`选择希望看到多少工具调用细节`,"settings.busySend":`繁忙时的发送行为`,"settings.busySendDesc":`智能体运行时 Enter 键和发送按钮的行为;Cmd/Ctrl+Enter 使用另一行为`,"settings.busySend.queue":`排队发送`,"settings.busySend.interrupt":`插话发送`,"settings.subagentModel":`子代理模型`,"settings.subagentModelDesc":`子代理默认跟随主会话模型;可改为当前提供商下的其它模型`,"settings.subagentModel.inherit":`跟随主会话`,"settings.platformVersion":`平台版本`,"settings.access.readonly":`仅可查看`,"settings.access.readwrite":`工作区内修改`,"settings.access.full":`完全权限`,"settings.step.concise":`简洁`,"settings.step.standard":`标准`,"settings.step.detailed":`详细`,"settings.step.full":`完全展开`,"settings.modelIntro":`填入各提供商的 API 密钥即可使用其模型。`,"settings.edit":`编辑`,"settings.delete":`删除`,"settings.addProvider":`+ 添加模型提供商`,"settings.back":`返回`,"settings.editProvider":`编辑提供商`,"settings.addProviderTitle":`添加提供商`,"settings.cancel":`取消`,"settings.save":`保存`,"settings.displayName":`显示名称`,"settings.preset":`服务商预设`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`模型`,"settings.keyHint":`模型保存在本机 ~/.config/lantern-harness/models.json,所有空间共用,不会上传 GitHub。`,"settings.modelPlaceholder":`请输入模型名`,"settings.recognizing":`识别中…`,"settings.recognized":`已识别 {n} 个`,"settings.recognizeFail":`识别失败,可手动填模型名`,"settings.recognizeKeep":`刷新失败,沿用已有列表`,"settings.deleteConfirm":`确定删除该模型提供商?`,"chat.emptyTitle":`提灯的人不问路`,"chat.emptyNoModel":`使用前请先配置模型。`,"chat.configureModel":`配置模型`,"chat.workbench":`我的工作台`,"chat.newSession":`新会话`,"chat.workspace":`工作区`,"tool.running":`工具执行中…`,"tool.callingKind":`正在调用{kind}`,"tool.doneKind":`{kind}完成`,"tool.callingNamed":`正在调用{kind}:{name}`,"tool.doneNamed":`{kind}完成:{name}`,"tool.callingFull":`正在调用{kind}({name})…`,"tool.doneFull":`{kind}已完成({name})`,"tool.kind.kb":`知识库`,"tool.kind.fs":`本地文件`,"tool.kind.memory":`会话记忆`,"tool.kind.webSearch":`网页搜索`,"tool.kind.webFetch":`网页获取`},i={"zh-CN":r,en:{"nav.home":`My Workbench`,"nav.dashboard":`Dashboard`,"nav.tasks":`Tasks`,"nav.todos":`Todos`,"nav.projects":`Projects`,"nav.iterations":`Iterations`,"nav.requirementsMgmt":`Requirements Mgmt`,"nav.bugs":`Bugs`,"nav.reports":`Work Report`,"nav.testStats":`Test Statistics`,"nav.caseExec":`Case Execution`,"nav.requirements":`Requirements`,"nav.caseManage":`Test Cases`,"nav.cases":`Cases`,"nav.templates":`Test Templates`,"nav.docs":`Documents`,"nav.createGroup":`New group`,"nav.createSubgroup":`New subgroup`,"nav.assignGroup":`Join group`,"nav.more":`More actions`,"nav.groupActions":`Group actions`,"nav.addSubgroup":`Add subgroup`,"nav.addToGroup":`Add to group`,"nav.chooseIcon":`Choose icon`,"nav.leaveGroup":`Remove from group`,"nav.currentGroup":`Current`,"nav.noGroups":`No groups yet`,"nav.noAddableItems":`Nothing to add`,"nav.editGroup":`Edit`,"nav.editGroupTitle":`Edit group`,"nav.sortMenu":`Sort`,"nav.sortMenuTitle":`Sort menu`,"nav.sortHint":`Drag to reorder`,"nav.subgroups":`Subgroups`,"nav.sortUp":`Move up`,"nav.sortDown":`Move down`,"nav.done":`Done`,"nav.deleteGroup":`Ungroup`,"nav.deleteGroupMsg":`Ungrouped items will be shown flat in the menu.`,"nav.deleteSubgroupMsg":`Ungrouping this subgroup returns its items to the parent group.`,"nav.groupName":`Group name`,"nav.groupItems":`Choose menu items`,"nav.groupItemsHint":`Items already in another group are hidden.`,"nav.groupNameRequired":`Enter a group name`,"nav.groupItemsRequired":`Select at least one item`,"nav.groupSave":`Save`,"nav.groupCancel":`Cancel`,"nav.prompts":`Prompts`,"nav.knowledge":`Knowledge Mgmt`,"nav.plugins":`My Plugins`,"nav.brand":`Lantern Harness`,"nav.settings":`Settings`,"nav.changelog":`Changelog`,"nav.changelogShort":`Changelog`,"nav.helpCenter":`Help Center`,"docs.nav.title":`Docs`,"docs.nav.changelog":`Changelog`,"docs.nav.manual":`User Guide`,"docs.nav.install":`Install Guide`,"nav.repo":`GitHub`,"nav.repoShort":`Repo`,"nav.npm":`npm package`,"nav.npmShort":`npm`,"nav.site":`Yycy Docs`,"nav.siteShort":`Site`,"nav.board":`Questions & suggestions`,"nav.boardShort":`Suggestions`,"space.label":`Data space`,"space.current":`Current space`,"space.switchTo":`Switch to this space`,"space.manage":`Manage spaces`,"space.others":`Other spaces`,"space.manageTitle":`Spaces`,"space.manageDesc":`Each data space is a fully isolated data directory: requirements, cases, prompts, knowledge, templates, sessions and config never leak across spaces.`,"space.listTitle":`All spaces`,"space.newTitle":`New space`,"space.newDesc":`Create an isolated data directory. The default prompt is created with the space and can be edited later in Prompt management.`,"space.addNew":`+ New space`,"space.edit":`Edit`,"space.editTitle":`Edit space`,"space.save":`Save`,"space.cancel":`Cancel`,"space.loading":`Loading…`,"space.detailFailed":`Failed to load space info`,"space.updateFailed":`Save failed`,"space.updated":`Saved "{name}"`,"space.publicNameLocked":`The public space name cannot be changed`,"space.switch":`Switch`,"space.nameLabel":`Space name`,"space.namePlaceholder":`Enter a space name`,"space.create":`Create`,"space.promptBriefLabel":`Prompt requirements`,"space.promptBriefPlaceholder":`Describe how the assistant should work. Enter or send to generate; Shift+Enter for a new line`,"space.promptGenerate":`Generate prompt`,"space.promptGenerating":`Generating…`,"space.promptGeneratingStatus":`Generating prompt`,"space.promptStop":`Stop generating`,"space.promptBodyLabel":`Default prompt`,"space.promptBodyPlaceholder":`Saved as 默认提示词.md in this space`,"space.promptHint":`Saved to this space’s Prompt management as the default prompt.`,"space.promptBriefHint":`Saved with the space so you can regenerate the prompt later.`,"space.promptEditHint":`Saving overwrites this space’s 默认提示词.md; the workbench uses it immediately.`,"space.promptNeedReq":`Write prompt requirements before generating.`,"space.promptNeedBody":`Fill in the default prompt first.`,"space.promptNeedModel":`Configure a working model in Settings before generating.`,"space.promptGenEmpty":`The model returned an empty prompt. Retry, or write one yourself.`,"space.needName":`Enter a space name first.`,"space.created":`Created "{name}"`,"space.createdWithPrompt":`Created "{name}". The default prompt is in Prompt management.`,"space.name":`Name`,"space.location":`Location`,"space.size":`Size`,"space.sizeTitle":`Measure disk usage for each space`,"space.sizing":`Measuring…`,"space.status":`Status`,"space.builtin":`Default`,"space.publicName":`Public space`,"space.activeTag":`Active`,"space.missing":`Directory missing`,"space.rename":`Rename`,"space.copy":`Copy`,"space.export":`Export`,"space.exportContent":`Export content`,"space.exportContentTitle":`Excludes keys, sessions, memories and caches — safe to share`,"space.exportFull":`Export backup`,"space.exportFullTitle":`Includes keys, sessions and all local state — for your own backup`,"space.discover":`Scan folder`,"space.discoverTitle":`Scan the managed folder for space folders carrying a .lantern/space.json manifest; other folders are listed for your confirmation`,"space.discovering":`Scanning…`,"space.discoverAdded":`Adopted {n} space(s)`,"space.discoverNone":`No adoptable space folder found`,"space.discoverBackfilled":`Wrote space.json manifests for {n} existing space(s)`,"space.discoverSkipped":`Skipped {n} (name conflict, invalid name, or missing space metadata)`,"space.candidatesTitle":`Found {n} folder(s) that are not spaces. Adopt them?`,"space.candidatesHint":`Checked folders are added to the list. No space manifest (.lantern/space.json) is written; folder contents stay untouched.`,"space.candidatesSelectAll":`Select all`,"space.candidatesClear":`Select none`,"space.candidatesIgnore":`Ignore`,"space.candidatesIgnored":`Ignored — nothing was adopted`,"space.candidatesAdopt":`Adopt selected`,"space.candidatesAdopted":`Adopted {n} folder(s)`,"space.candidatesRejected":`Not adopted: {names}`,"space.removeList":`Unlist`,"space.deleteDisk":`Delete data`,"space.import":`Import`,"space.refresh":`Refresh`,"space.empty":`No custom space yet — click "New space" to start.`,"space.newParentHint":`New spaces are created under:`,"space.switching":`Switching…`,"space.reloadHint":`The page reloads automatically after switching.`,"space.confirmRemoveTitle":`Remove from list`,"space.confirmRemoveMsg":`This removes "{name}" from the list but keeps its data on disk:
5
- {path}
6
- It can be added back later.`,"space.confirmDeleteTitle":`Delete data`,"space.confirmDeleteMsg":`This permanently deletes "{name}" and all of its data, with no way to undo:
7
- {path}`,"space.confirmCopyTitle":`Copy space`,"space.confirmCopyMsg":`All content of "{name}" will be copied into a new space. This can take a while for large spaces.`,"space.done":`Done`,"space.copyName":`New copy name`,"space.importPick":`Choose a zip backup to import`,"space.othersEmpty":`No other spaces yet. Open Manage spaces below to create or import one.`,"space.busyRuns":`A session is still running. Stop it before switching spaces.`,"space.publicLocked":`The built-in public space cannot be renamed or deleted.`,"space.offline":`Workspace unavailable`,"space.offlineCap":`Local service offline`,"settings.general":`General`,"settings.model":`Models`,"settings.close":`Close`,"settings.access":`Permissions`,"settings.accessDesc":`Default permission mode for new sessions`,"settings.language":`Language`,"settings.appearance":`Appearance`,"settings.appear.light":`Light`,"settings.appear.dark":`Dark`,"settings.appear.system":`System`,"settings.fontSize":`Font size`,"settings.fontSizeDesc":`Body and session text size (sidebar layout stays fixed)`,"settings.toolSteps":`Tool step detail`,"settings.toolStepsDesc":`How much tool-call detail to show`,"settings.busySend":`Send while busy`,"settings.busySendDesc":`Enter / Send while the agent is running; Cmd/Ctrl+Enter uses the other action`,"settings.busySend.queue":`Queue`,"settings.busySend.interrupt":`Interrupt`,"settings.subagentModel":`Subagent model`,"settings.subagentModelDesc":`Subagents inherit the main chat model by default; pick another from the active provider`,"settings.subagentModel.inherit":`Follow main chat`,"settings.platformVersion":`Platform version`,"settings.access.readonly":`View only`,"settings.access.readwrite":`Edit in workspace`,"settings.access.full":`Full access`,"settings.step.concise":`Concise`,"settings.step.standard":`Standard`,"settings.step.detailed":`Detailed`,"settings.step.full":`Full`,"settings.modelIntro":`Add each provider’s API key to use its models.`,"settings.edit":`Edit`,"settings.delete":`Delete`,"settings.addProvider":`+ Add model provider`,"settings.back":`Back`,"settings.editProvider":`Edit provider`,"settings.addProviderTitle":`Add provider`,"settings.cancel":`Cancel`,"settings.save":`Save`,"settings.displayName":`Display name`,"settings.preset":`Provider preset`,"settings.baseUrl":`Base URL`,"settings.apiKey":`API Key`,"settings.modelField":`Model`,"settings.keyHint":`Models are saved in ~/.config/lantern-harness/models.json and shared across spaces; never pushed to GitHub.`,"settings.modelPlaceholder":`Enter model id`,"settings.recognizing":`Detecting…`,"settings.recognized":`{n} models found`,"settings.recognizeFail":`Detection failed — enter a model id manually`,"settings.recognizeKeep":`Refresh failed — keeping previous list`,"settings.deleteConfirm":`Delete this model provider?`,"chat.emptyTitle":`Those who carry the lantern do not ask the way.`,"chat.emptyNoModel":`Configure a model to get started.`,"chat.configureModel":`Configure model`,"chat.workbench":`My Workbench`,"chat.newSession":`New chat`,"chat.workspace":`Workspace`,"tool.running":`Running tool…`,"tool.callingKind":`Calling {kind}`,"tool.doneKind":`{kind} done`,"tool.callingNamed":`Calling {kind}: {name}`,"tool.doneNamed":`{kind} done: {name}`,"tool.callingFull":`Calling {kind} ({name})…`,"tool.doneFull":`{kind} finished ({name})`,"tool.kind.kb":`knowledge base`,"tool.kind.fs":`local files`,"tool.kind.memory":`memory`,"tool.kind.webSearch":`web search`,"tool.kind.webFetch":`web fetch`}};function a(e,n,r){let a=i[r??(typeof window<`u`?t().language:`zh-CN`)]?.[e]??i[`zh-CN`][e]??e;if(n)for(let[e,t]of Object.entries(n))a=a.replaceAll(`{${e}}`,String(t));return a}function o(e){if(typeof document>`u`)return;let n=e??t().language;document.documentElement.lang=n===`en`?`en`:`zh-CN`,document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.dataset.i18n;t&&t in r&&(e.textContent=a(t,void 0,n))}),document.querySelectorAll(`[data-i18n-hint]`).forEach(e=>{let t=e.dataset.i18nHint;t&&t in r&&(e.dataset.hint=a(t,void 0,n))})}export{a as n,n as t};
@@ -1,4 +0,0 @@
1
- var e=`/__tb_pm`,t=[`planning`,`in_progress`,`archived`],n=[`planning`,`in_progress`,`done`],r=[`urgent`,`high`,`medium`,`low`],i=[`pending`,`todo`,`in_progress`,`testing`,`done`,`cancelled`],a=[`critical`,`major`,`minor`,`trivial`],o=[`pending`,`todo`,`in_progress`,`verifying`,`closed`],s={planning:`规划中`,in_progress:`进行中`,archived:`已归档`},c={planning:`规划中`,in_progress:`进行中`,done:`已完成`},l={urgent:`紧急`,high:`高`,medium:`中`,low:`低`},u={pending:`待评估`,todo:`待开发`,in_progress:`开发中`,testing:`测试中`,done:`已完成`,cancelled:`已取消`},d={critical:`致命`,major:`严重`,minor:`一般`,trivial:`轻微`},f={pending:`待确认`,todo:`待修复`,in_progress:`修复中`,verifying:`待验证`,closed:`已关闭`},p=/^\d{4}-\d{2}-\d{2}$/;function m(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function h(e){let t=m(e,10);return p.test(t)?t:``}function g(e,t,n){let r=m(e,40);return t.includes(r)?r:n}function _(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,50)){if(!n||typeof n!=`object`)continue;let e=m(n.text,500);e&&t.push({text:e,done:n.done===!0})}return t}function v(e){if(!e||typeof e!=`object`)return null;let n=e,r=m(n.name,200);if(!r)return null;let i=new Date().toISOString();return{id:m(n.id,64)||`pj_${Math.random().toString(16).slice(2,10)}`,name:r,description:m(n.description),status:g(n.status,t,`planning`),createdAt:m(n.createdAt,40)||i,updatedAt:m(n.updatedAt,40)||i}}function y(e){if(!e||typeof e!=`object`)return null;let t=e,r=m(t.name,200);if(!r)return null;let i=new Date().toISOString();return{id:m(t.id,64)||`it_${Math.random().toString(16).slice(2,10)}`,projectId:m(t.projectId,64),name:r,startDate:h(t.startDate),endDate:h(t.endDate),status:g(t.status,n,`planning`),remark:m(t.remark),createdAt:m(t.createdAt,40)||i,updatedAt:m(t.updatedAt,40)||i}}function b(e){if(!e||typeof e!=`object`)return null;let t=e,n=m(t.title,2e3);if(!n)return null;let a=new Date().toISOString();return{id:m(t.id,64)||`rq_${Math.random().toString(16).slice(2,10)}`,autoId:m(t.autoId,20),projectId:m(t.projectId,64),iterationId:m(t.iterationId,64),title:n,priority:g(t.priority,r,`medium`),status:g(t.status,i,`pending`),description:m(t.description),acceptanceCriteria:_(t.acceptanceCriteria),githubIssue:m(t.githubIssue,50),attachment:m(t.attachment),createdAt:m(t.createdAt,40)||a,updatedAt:m(t.updatedAt,40)||a}}function x(e){if(!e||typeof e!=`object`)return null;let t=e,n=m(t.title,200);if(!n)return null;let r=new Date().toISOString();return{id:m(t.id,64)||`bg_${Math.random().toString(16).slice(2,10)}`,autoId:m(t.autoId,20),projectId:m(t.projectId,64),iterationId:m(t.iterationId,64),requirementId:m(t.requirementId,64),title:n,severity:g(t.severity,a,`minor`),status:g(t.status,o,`pending`),reproduceSteps:m(t.reproduceSteps),expectedResult:m(t.expectedResult),actualResult:m(t.actualResult),environment:m(t.environment,500),githubIssue:m(t.githubIssue,50),attachment:m(t.attachment),remark:m(t.remark),createdAt:m(t.createdAt,40)||r,updatedAt:m(t.updatedAt,40)||r}}function S(e,t){return Array.isArray(e)?e.map(t).filter(e=>!!e):[]}function C(){return{projects:[],iterations:[],requirements:[],bugs:[]}}function w(e){if(!e||typeof e!=`object`)return C();let t=e;return{projects:S(t.projects,v),iterations:S(t.iterations,y),requirements:S(t.requirements,b),bugs:S(t.bugs,x)}}async function T(t,n){let r=await fetch(e,{method:t,headers:n===void 0?void 0:{"Content-Type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.error||`HTTP ${r.status}`);return i}async function E(){try{return(await fetch(`${e}?health=1`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function D(){return w(await T(`GET`))}async function O(){await D()}function k(e,t){return e===`projects`?v(t):e===`iterations`?y(t):e===`requirements`?b(t):x(t)}async function A(e,t,n){let r=await T(`POST`,{entity:e,items:t,...n});return(Array.isArray(r.items)?r.items:[]).map(t=>k(e,t)).filter(e=>!!e)}async function j(e,t,n){let r=k(e,(await T(`PUT`,{entity:e,id:t,...n})).item);if(!r)throw Error(`更新记录失败`);return r}async function M(e,t){let n=await T(`DELETE`,{entity:e,ids:t});return{removed:Number(n.removed??0),cascaded:Number(n.cascaded??0)}}function N(e){let[t,n,r]=e.split(`-`).map(Number);return Date.UTC(t,(n??1)-1,r??1)}function P(e,t){return!p.test(e)||!p.test(t)?null:Math.round((N(t)-N(e))/864e5)}function F(e=new Date){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function I(e,t=F()){let n=P(e.startDate,e.endDate);if(n===null)return 0;let r=n+1,i=P(e.startDate,t);return i===null?0:Math.min(100,Math.max(0,Math.round((i+1)/r*100)))}function L(e,t=F()){if(e.status===`done`)return null;let n=P(e.endDate,t);return n===null?null:n>0?n:null}function R(e){let t={};for(let n of e.projects)t[n.id]={iterations:0,requirements:0,requirementsDone:0,bugs:0,bugsClosed:0,requirementPercent:0,bugClosedPercent:100};for(let n of e.iterations){let e=t[n.projectId];e&&(e.iterations+=1)}for(let n of e.requirements){let e=t[n.projectId];e&&(e.requirements+=1,n.status===`done`&&(e.requirementsDone+=1))}for(let n of e.bugs){let e=t[n.projectId];e&&(e.bugs+=1,n.status===`closed`&&(e.bugsClosed+=1))}for(let e of Object.values(t))e.requirementPercent=e.requirements?Math.round(e.requirementsDone/e.requirements*100):0,e.bugClosedPercent=e.bugs?Math.round(e.bugsClosed/e.bugs*100):100;return t}function z(e,t={}){let n=t.status??`all`,r=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.status!==n||r&&!`${e.name} ${e.description}`.toLowerCase().includes(r)))}function B(e,t={}){let n=t.projectId??`all`,r=t.status??`all`,i=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.status!==r||i&&!`${e.name} ${e.remark}`.toLowerCase().includes(i)))}function V(e,t={}){let n=t.projectId??`all`,r=t.iterationId??`all`,i=t.status??`all`,a=t.priority??`all`,o=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.iterationId!==r||i!==`all`&&e.status!==i||a!==`all`&&e.priority!==a||o&&!`${e.autoId} ${e.title} ${e.description}`.toLowerCase().includes(o)))}function H(e,t={}){let n=t.projectId??`all`,r=t.iterationId??`all`,i=t.status??`all`,a=t.severity??`all`,o=(t.keyword??``).trim().toLowerCase();return e.filter(e=>!(n!==`all`&&e.projectId!==n||r!==`all`&&e.iterationId!==r||i!==`all`&&e.status!==i||a!==`all`&&e.severity!==a||o&&!`${e.autoId} ${e.title} ${e.reproduceSteps}`.toLowerCase().includes(o)))}function U(e,t){let n=t.trim();if(!n)return``;let r=e.find(e=>e.name===n);if(r)return r.id;let i=n.toLowerCase();return e.find(e=>e.name.toLowerCase()===i)?.id??``}function W(e,t){let n=t.trim();if(!n)return``;let r=n.toLowerCase();return e.find(e=>e.title===n)?.id??e.find(e=>e.title.toLowerCase()===r)?.id??e.find(e=>e.autoId.toLowerCase()===r)?.id??``}function G(e){let t=e.split(`
2
- `).map(e=>e.trim()).find(Boolean);return t?Array.from(t).slice(0,60).join(``):``}function K(e){return e.split(`
3
- `).map(e=>e.trim()).filter(Boolean).map(e=>({url:e,name:Y(e)}))}function q(e){return e.map(e=>e.url).join(`
4
- `)}function J(e){try{let t=new URL(e,`http://localhost`).searchParams.get(`p`)??``;return/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(decodeURIComponent(t))}catch{return!1}}function Y(e){try{let t=new URL(e,`http://localhost`),n=t.searchParams.get(`p`),r=n?decodeURIComponent(n):t.pathname;return(r.split(`/`).filter(Boolean).pop()??r).replace(/^\d{10,}-[a-z0-9]+-/,``)}catch{return e}}function X(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode(...t.subarray(e,e+n));return btoa(r)}async function Z(e){if(!e.length)return[];let t=await T(`POST`,{upload:await Promise.all(e.map(async e=>({name:e.name||`attachment`,type:e.type||`application/octet-stream`,data:X(await e.arrayBuffer())})))});return(Array.isArray(t.files)?t.files:[]).map(e=>{let t=e,n=typeof t.url==`string`?t.url:``;return n?{url:n,name:typeof t.name==`string`&&t.name?t.name:Y(n)}:null}).filter(e=>!!e)}async function Q(e,t=``){let n=e.filter(Boolean);if(n.length)try{await T(`POST`,t?{cleanup:n,bugId:t}:{cleanup:n})}catch{}}export{K as A,V as C,L as D,J as E,Z as F,O as M,F as N,I as O,j as P,z as S,W as T,C as _,n as a,H as b,s as c,i as d,u as f,M as g,A as h,f as i,R as j,q as k,r as l,Q as m,d as n,c as o,G as p,o as r,t as s,a as t,l as u,E as v,U as w,B as x,D as y};