lantern-harness 0.1.35 → 0.1.37

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 (75) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/500.html +4 -4
  3. package/dist/_astro/Base.B-G3Zgu4.css +1 -0
  4. package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.CiZNg228.js → Base.astro_astro_type_script_index_0_lang.CdBewZc9.js} +1 -1
  5. package/dist/_astro/CaseExecBoard.BWxBjYPI.js +1 -0
  6. package/dist/_astro/{CaseGenerateApp.BvRwwxhs.js → CaseGenerateApp.Hq9MCdxl.js} +1 -1
  7. package/dist/_astro/CasesLibrary.DptLD8ae.js +24 -0
  8. package/dist/_astro/ChatApp.CUrUFBY4.js +226 -0
  9. package/dist/_astro/{DashboardBoard.BuyuI8WW.js → DashboardBoard.BTFyQf9w.js} +1 -1
  10. package/dist/_astro/{KnowledgeLibrary.CQ8ULHI5.js → KnowledgeLibrary.CiBRybeE.js} +1 -1
  11. package/dist/_astro/{LifeKrTasksBoard.BWoB442i.js → LifeKrTasksBoard.RENBU_z9.js} +1 -1
  12. package/dist/_astro/{LifeKrTodosBoard.rDbG9XcJ.js → LifeKrTodosBoard.CbNnGHSZ.js} +1 -1
  13. package/dist/_astro/{LifeObjectivesBoard.DUDQg_RD.js → LifeObjectivesBoard.BTGFpny2.js} +1 -1
  14. package/dist/_astro/{LifePlanTypeSelect.BtXnXOkz.js → LifePlanTypeSelect.BGtEEsL-.js} +1 -1
  15. package/dist/_astro/{LifeReviewsBoard.p-dp_NXl.js → LifeReviewsBoard.Bn-uxMI5.js} +1 -1
  16. package/dist/_astro/LifeShared.SnLIiFdN.js +3 -0
  17. package/dist/_astro/{LifeStagesBoard.BSvhzmp_.js → LifeStagesBoard.DrbIVrCK.js} +1 -1
  18. package/dist/_astro/{LifeYearCycleSelect.Q4VvLY8X.js → LifeYearCycleSelect.CuiWO8Tc.js} +1 -1
  19. package/dist/_astro/{LifeYearPlansBoard.CYN2gZKp.js → LifeYearPlansBoard.ChAoQUB5.js} +1 -1
  20. package/dist/_astro/{PluginsPage.DE3qbeY5.js → PluginsPage.6moeF68Q.js} +1 -1
  21. package/dist/_astro/PluginsPage.YOpImJhn.js +1 -0
  22. package/dist/_astro/{PromptsLibrary.Dp1S_lHQ.js → PromptsLibrary.D8n2TGTV.js} +1 -1
  23. package/dist/_astro/ReportsPage.BU3GtBvl.js +1 -0
  24. package/dist/_astro/{ReqAnalysisBoard.B3bhMWmE.js → ReqAnalysisBoard.1OolNXqU.js} +1 -1
  25. package/dist/_astro/{SettingsDialog.BzGBZlo2.js → SettingsDialog.BMph2QUr.js} +1 -1
  26. package/dist/_astro/{TodosBoard.Bkuw_LDW.js → TodosBoard.ofiKHKcQ.js} +1 -1
  27. package/dist/_astro/app-version.DAXbxwiA.js +1 -0
  28. package/dist/_astro/{case-exec.BLqTXR7U.js → case-exec.BMNk9OyF.js} +1 -1
  29. package/dist/_astro/{case-gen-run.CH0ldlsU.js → case-gen-run.C_Y3mlu1.js} +1 -1
  30. package/dist/_astro/open-docs-in-session.5cTowYAC.js +1 -0
  31. package/dist/_astro/{report-prompt.CAfZ6RIo.js → report-prompt.B9C4cv84.js} +1 -1
  32. package/dist/_astro/{req-analysis.CjhgP3jI.js → req-analysis.BgIbt-VI.js} +1 -1
  33. package/dist/_astro/{story-review.BBfB1qYF.js → story-review.D6yzlcwY.js} +1 -1
  34. package/dist/case-exec/index.html +5 -5
  35. package/dist/cases/generate/index.html +5 -5
  36. package/dist/cases/library/index.html +5 -5
  37. package/dist/dashboard/index.html +5 -5
  38. package/dist/docs/changelog/index.html +67 -41
  39. package/dist/docs/install/index.html +4 -4
  40. package/dist/docs/manual/index.html +10 -9
  41. package/dist/knowledge/index.html +5 -5
  42. package/dist/life/kr-tasks/index.html +5 -5
  43. package/dist/life/kr-todos/index.html +5 -5
  44. package/dist/life/objectives/index.html +5 -5
  45. package/dist/life/reviews/index.html +5 -5
  46. package/dist/life/stages/index.html +5 -5
  47. package/dist/life/year-plans/index.html +5 -5
  48. package/dist/plugins/index.html +5 -5
  49. package/dist/pm/bugs/index.html +4 -4
  50. package/dist/pm/iterations/index.html +4 -4
  51. package/dist/pm/projects/detail/index.html +4 -4
  52. package/dist/pm/projects/index.html +4 -4
  53. package/dist/pm/requirements/index.html +4 -4
  54. package/dist/prompts/index.html +5 -5
  55. package/dist/reports/index.html +5 -5
  56. package/dist/requirement-analysis/index.html +5 -5
  57. package/dist/requirements/index.html +4 -4
  58. package/dist/tasks/index.html +4 -4
  59. package/dist/templates/index.html +4 -4
  60. package/dist/test-automation/index.html +4 -4
  61. package/dist/test-stats/index.html +4 -4
  62. package/dist/todos/index.html +5 -5
  63. package/dist/workbench/index.html +5 -5
  64. package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +6 -5
  65. package/lh-plugins/lh-reports.mjs +50 -0
  66. package/package.json +1 -1
  67. package/dist/_astro/Base.DjXU-4S_.css +0 -1
  68. package/dist/_astro/CaseExecBoard.DzNtPCwr.js +0 -1
  69. package/dist/_astro/CasesLibrary.B9I31b7C.js +0 -24
  70. package/dist/_astro/ChatApp.79JSgx7d.js +0 -226
  71. package/dist/_astro/LifeShared.Di9sdb_T.js +0 -3
  72. package/dist/_astro/PluginsPage.r98lZChB.js +0 -1
  73. package/dist/_astro/ReportsPage.C8uufWVb.js +0 -1
  74. package/dist/_astro/app-version.CXqYg1a3.js +0 -1
  75. package/dist/_astro/open-docs-in-session.BdihMTEh.js +0 -1
@@ -1,3 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n}from"./app-config.C4rpn1Ix.js";import{i as r,o as i,s as a}from"./plugins.C0NrHGZv.js";import{a as o,n as s,o as c,r as l,s as u,t as d}from"./view-prefs.8MPl3A7e.js";import{i as f,n as p,r as ee,t as m}from"./dialog.DZHZCe_T.js";import{t as h}from"./jsx-runtime.DUg_B_vD.js";import{t as te}from"./DatePicker.Bkl71M49.js";import{t as g}from"./OverflowHint.pvo2Xc8R.js";var _=e(t(),1),v=`/__tb_life`,ne=[`pending`,`in_progress`,`overdue`,`stalled`,`done`,`closed`],y=[`pool`,`in_progress`,`incomplete`,`done`,`closed`],b=[`in_progress`,`incomplete`,`done`],re=[`urgent_important`,`urgent`,`important`,`normal`],ie={learning:`pt_learning`,work:`pt_work`,family:`pt_family`,side:`pt_side`},ae=[`Q1`,`Q2`,`Q3`,`Q4`],x={pending:`待开始`,in_progress:`进行中`,overdue:`已延期`,done:`已完成`,stalled:`已停滞`,closed:`已关闭`},oe={pool:`任务池`,in_progress:`进行中`,done:`已完成`,incomplete:`未完成`,closed:`已关闭`},se={in_progress:`进行中`,incomplete:`未完成`,done:`已完成`},ce={urgent_important:`重要紧急`,urgent:`紧急不重要`,important:`重要不紧急`,normal:`不重要不紧急`,"":`—`},le={learning:`学习成长`,work:`工作管理`,family:`家庭生活`,side:`副业赚钱`,pt_learning:`学习成长`,pt_work:`工作管理`,pt_family:`家庭生活`,pt_side:`副业赚钱`,"":`—`};function ue(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function de(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function S(e){return[...e].sort((e,t)=>{let n=(t.updatedAt||``).localeCompare(e.updatedAt||``);return n===0?e.name.localeCompare(t.name,`zh`):n})}function C(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:le[t]||t}function w(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:t}function T(e,t){if(!t)return``;let n=e.find(e=>e.id===t);return n?n.name:t}function E(e,t){let n=M(e,40);return n?t.some(e=>e.id===n)?n:t.find(e=>e.name===n)?.id??``:``}function D(e,t){let n=M(e,60);return n?t.some(e=>e.id===n)?n:t.find(e=>e.name===n)?.id??``:``}function O(e,t){let n=M(e,64);if(!n)return``;if(t.has(n))return n;let r=ie[n];return r&&t.has(r)?r:``}var k=`1) 有什么是做得好的
2
- 2) 有什么是做得不够好的
3
- 3) 总结如何下次做得更好`,A={Q1:`Q1(1月-3月)`,Q2:`Q2(4月-6月)`,Q3:`Q3(7月-9月)`,Q4:`Q4(10月-12月)`,"":`—`},j=/^\d{4}-\d{2}-\d{2}$/;function M(e,t=2e3){return typeof e==`string`?e.trim().slice(0,t):``}function N(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function P(e,t){if(!j.test(e)||!j.test(t))return null;let n=Date.parse(`${e}T00:00:00`),r=Date.parse(`${t}T00:00:00`);return!Number.isFinite(n)||!Number.isFinite(r)?null:Math.max(1,Math.round((r-n)/864e5)+1)}function F(e){return e==null?`—`:`${e} 天`}function I(){return{krTodos:[],krTasks:[],objectives:[],reviews:[],yearPlans:[],lifeStages:[],planTypes:[],yearCycles:[],lifeCycles:[]}}function L(e){return Array.isArray(e)?e:[]}function R(e){if(!e||typeof e!=`object`)return null;let t=e,n=M(t.name,40),r=M(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:M(t.createdAt,40),updatedAt:M(t.updatedAt,40)}}function z(e){if(!e||typeof e!=`object`)return null;let t=e,n=M(t.name,40),r=M(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:M(t.createdAt,40),updatedAt:M(t.updatedAt,40)}}function B(e){if(!e||typeof e!=`object`)return null;let t=e,n=M(t.name,60),r=M(t.id,64);return!n||!r?null:{id:r,name:n,createdAt:M(t.createdAt,40),updatedAt:M(t.updatedAt,40)}}function V(e){if(!e||typeof e!=`object`)return I();let t=e,n=L(t.planTypes).map(R).filter(e=>!!e),r=new Set(n.map(e=>e.id)),i=L(t.yearCycles).map(z).filter(e=>!!e),a=L(t.lifeCycles).map(B).filter(e=>!!e),o=e=>({...e,planType:O(e.planType,r)}),s=e=>({...e,yearCycle:E(e.yearCycle,i)}),c=e=>{let t=e.lifeCycle||e.ageRange,{ageRange:n,...r}=e;return{...r,lifeCycle:D(t,a)}},l=L(t.yearPlans).map(o).map(s),u=new Set(l.map(e=>e.id)),d=L(t.objectives).map(s).map(e=>{let t=M(e.yearPlanId,64);return{...e,yearPlanId:t&&u.has(t)?t:``}});return{krTodos:L(t.krTodos),krTasks:L(t.krTasks).map(o),objectives:d,reviews:L(t.reviews),yearPlans:l,lifeStages:L(t.lifeStages).map(o).map(c),planTypes:n,yearCycles:i,lifeCycles:a}}async function H(){let e=await fetch(v,{headers:{Accept:`application/json`}}),t=await e.json().catch(()=>({}));if(!e.ok||!t?.ok)throw Error(M(t?.error)||`读取失败(${e.status})`);return V(t)}async function fe(){let e=await(await fetch(`${v}?health=1`,{headers:{Accept:`application/json`}})).json().catch(()=>({}));return{ok:!!e?.ok,files:e?.files}}async function pe(e,t){let n=await fetch(v,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,items:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r?.ok)throw Error(M(r?.error)||`创建失败(${n.status})`);return{items:L(r.items),total:Number(r.total)||0}}async function me(e,t,n){let r=await fetch(v,{method:`PUT`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,id:t,...n})}),i=await r.json().catch(()=>({}));if(!r.ok||!i?.ok)throw Error(M(i?.error)||`更新失败(${r.status})`);return i.item}async function he(e,t){let n=await fetch(v,{method:`DELETE`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({entity:e,ids:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r?.ok)throw Error(M(r?.error)||`删除失败(${n.status})`);return{removed:Number(r.removed)||0,total:Number(r.total)||0}}function U(e,t){let n=t.filter(t=>t.krTaskId===e),r=n.filter(e=>e.status===`done`).length,i=n.length,a=i===0?0:Math.round(r/i*100),o=n.map(e=>e.title),s=new Map;for(let e of n)s.set(e.status,(s.get(e.status)??0)+1);return{count:i,done:r,progress:a,titles:o,summary:i===0?`暂无待办`:[...s.entries()].map(([e,t])=>`${x[e]??e} ${t}`).join(` · `)}}function ge(e,t,n){let r=t.filter(t=>t.objectiveId===e);if(!r.length)return 0;let i=r.reduce((e,t)=>e+U(t.id,n).progress,0);return Math.round(i/r.length)}function _e(e,t){return t.filter(t=>t.objectiveId===e).map(e=>e.title)}function ve(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.title.toLowerCase().includes(n)||(e.note??``).toLowerCase().includes(n)):e}var W=h(),ye=8e3;function be(){return a(`life`)}function xe(){let[e,t]=(0,_.useState)(!1),[a,o]=(0,_.useState)(()=>r(`life`));return(0,_.useEffect)(()=>{let e=!0,a=i(()=>o(r(`life`)));return n().then(()=>{e&&(o(r(`life`)),t(!0))}),()=>{e=!1,a()}},[]),{ready:e,on:a}}function Se(e){let[t,n]=(0,_.useState)(I),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(!0),u=(0,_.useCallback)(async(e=!1)=>{e||o(!0);try{let e=await H();return l.current?(n(e),i(!0),c(``),e):null}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}finally{l.current&&!e&&o(!1)}},[]),d=(0,_.useCallback)(async(e,t)=>{let n=await pe(e,t);return await u(!0),n},[u]),f=(0,_.useCallback)(async(e,t,n)=>{await me(e,t,n),await u(!0)},[u]),p=(0,_.useCallback)(async(e,t)=>{await he(e,t),await u(!0)},[u]);return(0,_.useEffect)(()=>{if(!e){o(!1);return}l.current=!0;let t=null;return(async()=>{try{let e=await fe();if(!l.current)return;if(!e.ok){i(!1),o(!1);return}if(await u(),!l.current)return;i(!0),t=window.setInterval(()=>void u(!0),ye)}catch{if(!l.current)return;i(!1),o(!1)}})(),()=>{l.current=!1,t!==null&&window.clearInterval(t)}},[e,u]),{store:t,live:r,loading:a,error:s,setError:c,reload:u,createItems:d,updateItem:f,deleteItems:p}}function Ce(e){let[t,n]=(0,_.useState)(()=>l(e));return[t,(0,_.useCallback)(t=>{n(t),u(e,t)},[e])]}function we(e,t,n){let[r,i]=(0,_.useState)(()=>s(e,t,n));return[r,(0,_.useCallback)(t=>{i(t),c(e,t)},[e])]}function Te(e){let[t,n]=(0,_.useState)({}),r=(0,_.useMemo)(()=>new Set(e),[e]);(0,_.useEffect)(()=>{n(e=>{let t=!1,n={};for(let[i,a]of Object.entries(e))r.has(i)&&a?n[i]=!0:a&&(t=!0);return t||Object.keys(n).length!==Object.keys(e).length?n:e})},[r]);let i=(0,_.useMemo)(()=>Object.keys(t).filter(e=>t[e]),[t]),a=e.length>0&&e.every(e=>t[e]);function o(e){n(t=>({...t,[e]:!t[e]}))}function s(){n(t=>{let n={...t},r=!a;for(let t of e)n[t]=r;return n})}function c(){n({})}return{selected:t,selectedIds:i,allVisibleSelected:a,toggle:o,toggleAllVisible:s,clear:c}}function G(e){return e.items?e.items.length:(e.children??[]).reduce((e,t)=>e+G(t),0)}function K(e,t){let n=[],r=(e,i)=>{for(let a of e){let e=!!a.children?.length,o=G(a);if(o===0&&e||o===0&&a.items===void 0)continue;let s=!t[a.key];n.push({key:a.key,label:a.label,pill:a.pill,depth:i,count:o,kind:e?`section`:`tag`,items:e||!s?void 0:a.items??[]}),s&&e&&r(a.children,i+1)}};return r(e,0),n}function Ee(e,t){return K(e,t).flatMap(e=>e.items?e.items.map(e=>e.id):[])}function q(e=!1){return 36+(e?28:0)}function J(e=!1){return{"--tw-sticky-left":`${q(e)}px`}}J(!1);var De=`relative px-2 py-2 text-left text-xs font-medium whitespace-nowrap text-stone-500`,Oe=`relative border-l border-stone-200/90 px-2 py-2 text-left text-xs font-medium whitespace-nowrap text-stone-500`,Y=new Set([`select`,`title`,`filler`,`action`]);function ke(e){let t=(e??``).trim();if(!t)return`—`;let n=Date.parse(t);if(!Number.isFinite(n)){let e=t.slice(0,10);return/^\d{4}-\d{2}-\d{2}$/.test(e)?e.replace(/-/g,`/`):`—`}let r=new Date(n);return`${r.getFullYear()}/${String(r.getMonth()+1).padStart(2,`0`)}/${String(r.getDate()).padStart(2,`0`)} ${String(r.getHours()).padStart(2,`0`)}:${String(r.getMinutes()).padStart(2,`0`)}`}function Ae(e,t){let n=(0,_.useMemo)(()=>new Set(t.map(e=>e.key)),[t]),[r,i]=(0,_.useState)(()=>{let t=d(e,[]);return Array.isArray(t)?t.filter(e=>typeof e==`string`&&n.has(e)):[]});return(0,_.useEffect)(()=>{i(e=>{let t=e.filter(e=>n.has(e));return t.length===e.length?e:t})},[n]),{isVisible:(0,_.useCallback)(e=>Y.has(e)||!n.has(e)?!0:!r.includes(e),[n,r]),toggle:(0,_.useCallback)(t=>{!Y.has(t)&&n.has(t)&&i(n=>{let r=n.includes(t)?n.filter(e=>e!==t):[...n,t];return o(e,r),r})},[n,e]),hidden:r,fields:t}}function je(e,t){return e.filter(e=>t(e.key))}function Me(e){let[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;function e(e){r.current?.contains(e.target)||n(!1)}function i(e){e.key===`Escape`&&n(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,W.jsxs)(`div`,{ref:r,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-label":`字段配置`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex h-9 items-center gap-1.5 rounded-lg border px-2.5 text-sm transition-colors ${t?`border-[#3370ff]/40 bg-[#e1eaff] text-[#1f4ec2]`:`border-stone-200 text-stone-600 hover:bg-stone-50 hover:text-stone-800`}`,children:[(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:`M4 6h16M4 12h10M4 18h14`})}),`字段`]}),t?(0,W.jsxs)(`div`,{className:`tw-select-menu absolute right-0 z-80 mt-1 w-52 overflow-hidden rounded-lg bg-white p-1 shadow-lg ring-1 ring-stone-200`,children:[(0,W.jsx)(`div`,{className:`px-2.5 py-1.5 text-[11px] font-medium tracking-wide text-stone-400`,children:`显示字段`}),e.fields.map(t=>{let n=e.isVisible(t.key);return(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-stone-700 hover:bg-stone-50`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>e.onToggle(t.key),className:`rounded border-stone-300 text-[#4176e6] focus:ring-[#4176e6]/40`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label})]},t.key)})]}):null]})}var Ne=`tw-sticky-l px-0 py-1 align-middle`,X=`tw-sticky-l px-0 py-2 text-left font-medium whitespace-nowrap`,Pe=`h-8 w-full justify-start rounded-md border border-stone-200 bg-white px-2 text-left text-sm font-normal text-stone-400 hover:border-stone-300 focus:ring-2 focus:ring-[#3370ff]/30`,Fe=`h-8 w-full justify-start bg-transparent px-0 text-left focus:ring-0`,Ie=`未选择`,Le=`未关联`,Re=`未设置年度`;function ze(e){return(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`text-stone-400 transition-transform duration-200 ease-out ${e.open?`rotate-0`:`-rotate-90`}`,children:(0,W.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function Be(e){let t=(e.depth??0)>0,n=e.selectColPx??36;e.kind;let r=(0,W.jsx)(`span`,{className:`max-w-[min(100%,16rem)] truncate rounded-full px-2.5 py-0.5 text-xs font-medium ${e.pill}`,children:e.label}),i=(0,W.jsxs)(`span`,{className:`shrink-0 text-xs text-stone-400 tabular-nums`,children:[e.count,` 条记录`]}),a=(0,W.jsx)(`span`,{className:`flex h-7 w-9 shrink-0 items-center justify-center`,children:(0,W.jsx)(ze,{open:e.open})});if(!t){let t=Math.max(0,e.colSpan-2);return(0,W.jsxs)(`tr`,{className:`bg-white`,style:{"--tw-row-bg":`#ffffff`,"--life-select-w":`${n}px`},children:[(0,W.jsx)(`td`,{colSpan:2,className:`tw-sticky-l tw-life-group-sticky-lead border-b border-stone-100 px-0 pb-1.5 pt-3 align-middle`,style:{left:0,"--tw-sticky-left":`0px`},children:(0,W.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":e.open,"aria-label":e.open?`收起分组`:`展开分组`,className:`flex w-full items-center gap-2 py-1.5 pr-2 text-left transition-colors duration-200 hover:bg-stone-50`,children:[a,r,i]})}),t>0?(0,W.jsx)(`td`,{colSpan:t,className:`border-b border-stone-100 bg-white pb-1.5 pt-3`,"aria-hidden":`true`}):null]})}let o=Math.max(0,e.colSpan-2);return(0,W.jsxs)(`tr`,{className:`bg-white`,style:{"--tw-row-bg":`#ffffff`,"--life-select-w":`${n}px`},children:[(0,W.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-lead border-b border-stone-100 px-0 py-0.5 align-middle`,style:{left:0,width:n,minWidth:n,maxWidth:n,"--tw-sticky-left":`0px`},children:(0,W.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":e.open,"aria-label":e.open?`收起分组`:`展开分组`,className:`flex w-full items-center py-1.5 transition-colors duration-200 hover:bg-[#f7f8fa]`,children:[(0,W.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}),a]})}),(0,W.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-label border-b border-stone-100 px-2 py-0.5 align-middle`,style:{left:n,"--tw-sticky-left":`${n}px`},children:(0,W.jsxs)(`button`,{type:`button`,onClick:e.onToggle,"aria-expanded":e.open,className:`flex w-full min-w-0 items-center gap-2 py-1.5 text-left transition-colors duration-200 hover:bg-[#f7f8fa]`,children:[r,i]})}),o>0?(0,W.jsx)(`td`,{colSpan:o,className:`border-b border-stone-100 bg-white py-0.5`,"aria-hidden":`true`}):null]})}function Ve(e){let t=(e.depth??0)>0,n=e.selectColPx??36,r=Math.max(0,e.colSpan-2);return(0,W.jsxs)(`tr`,{className:`tw-life-group-body`,style:{"--life-select-w":`${n}px`},children:[(0,W.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-lead px-0 py-0.5 align-middle`,style:{left:0,width:n,minWidth:n,maxWidth:n,"--tw-sticky-left":`0px`},children:(0,W.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":`新增记录`,className:`flex w-full items-center py-0.5 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-600 disabled:opacity-40`,children:[t?(0,W.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,W.jsx)(`span`,{className:`flex h-7 w-9 shrink-0 items-center justify-center text-sm leading-none`,children:`+`})]})}),(0,W.jsx)(`td`,{className:`tw-sticky-l tw-life-group-sticky-label px-2 py-0.5 align-middle`,style:{left:n,"--tw-sticky-left":`${n}px`},children:(0,W.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,className:`rounded py-0.5 text-xs text-stone-400 transition-colors hover:text-stone-600 disabled:opacity-40`,children:`新增记录`})}),r>0?(0,W.jsx)(`td`,{colSpan:r,className:`bg-white py-0.5`,"aria-hidden":`true`}):null]})}var He=`h-8 w-full truncate rounded-md border border-[#3370ff]/40 bg-white px-2 text-sm text-stone-800 outline-none focus:border-[#3370ff] disabled:opacity-50`;function Ue(e){let t=(0,_.useRef)(e.row);t.current=e.row;let n=(0,_.useRef)(e.submitting);n.current=e.submitting;let r=(0,_.useRef)(e.onSubmit);r.current=e.onSubmit;let i=(0,_.useRef)(e.isPristine);i.current=e.isPristine;let a=(0,_.useRef)(e.setRow);a.current=e.setRow;let o=(0,_.useCallback)(async()=>{let e=t.current;if(!e||n.current)return;let i=e.title.trim();i&&await r.current({...e,title:i})},[]);return(0,_.useEffect)(()=>{if(e.row==null)return;let n=e=>{let n=e.target;if(!(n instanceof Element)||n.closest(`.tw-new-row`)||n.closest(`.tw-select-menu`)||n.closest(`.tw-date-panel`)||n.closest(`.tw-confirm-dialog`)||n.closest(`[data-headlessui-portal]`))return;let r=t.current;r&&(r.title.trim()?o():i.current(r)&&a.current(null))};return document.addEventListener(`pointerdown`,n,!0),()=>document.removeEventListener(`pointerdown`,n,!0)},[e.row,o]),{submit:o}}function We(e){let t=Math.max(0,Math.min(100,Math.round(e.value)));return(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5 ${e.className??``}`,children:[(0,W.jsx)(`span`,{className:`h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-stone-100`,children:(0,W.jsx)(`span`,{className:`block h-full rounded-full bg-[#3370ff]`,style:{width:`${t}%`}})}),(0,W.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[t,`%`]})]})}function Ge(e){let t=Math.max(0,Math.min(100,Math.round(e.value)));return(0,W.jsxs)(`div`,{className:`flex items-center gap-2.5 ${e.className??``}`,children:[(0,W.jsxs)(`div`,{className:`relative flex h-6 min-w-0 flex-1 items-center`,children:[(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 h-1.5 overflow-hidden rounded-full bg-stone-100`,"aria-hidden":`true`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full bg-[#3370ff] transition-[width] duration-75`,style:{width:`${t}%`}})}),(0,W.jsx)(`input`,{type:`range`,min:0,max:100,value:t,"aria-label":e.ariaLabel??`进度`,onChange:t=>e.onChange(Number(t.target.value)),onMouseUp:t=>e.onCommit?.(Number(t.target.value)),onTouchEnd:t=>e.onCommit?.(Number(t.target.value)),onKeyUp:t=>{(t.key===`ArrowLeft`||t.key===`ArrowRight`||t.key===`Home`||t.key===`End`)&&e.onCommit?.(Number(t.target.value))},className:`tw-life-range relative z-1 w-full`})]}),(0,W.jsxs)(`span`,{className:`w-9 shrink-0 text-right text-xs tabular-nums text-stone-500`,children:[t,`%`]})]})}function Ke(e){let t=(0,_.useRef)(null);return(0,_.useEffect)(()=>{t.current&&(t.current.indeterminate=!!e.indeterminate&&!e.checked)},[e.checked,e.indeterminate]),(0,W.jsx)(`th`,{className:X,"aria-label":`全选`,children:(0,W.jsxs)(`div`,{className:`flex items-center`,children:[e.nested?(0,W.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,W.jsx)(`div`,{className:`flex h-7 w-9 items-center justify-center`,children:(0,W.jsx)(`input`,{ref:t,type:`checkbox`,checked:e.checked,onChange:e.onChange,"aria-label":`全选`,className:`h-3.5 w-3.5 rounded border-stone-300 text-[#3370ff] focus:ring-[#3370ff]/30`})})]})})}function qe(e){let t=!!(e.selecting||e.checked),n=(e.depth??0)>0;return(0,W.jsx)(`td`,{className:Ne,children:(0,W.jsxs)(`div`,{className:`flex items-center`,children:[n?(0,W.jsx)(`span`,{className:`inline-block shrink-0`,style:{width:28},"aria-hidden":`true`}):null,(0,W.jsxs)(`div`,{className:`relative flex h-7 w-9 shrink-0 items-center justify-center`,children:[(0,W.jsx)(`span`,{className:`text-xs tabular-nums text-stone-400 transition-opacity ${t?`opacity-0`:`opacity-100 group-hover/row:opacity-0`}`,children:e.index}),(0,W.jsx)(`input`,{type:`checkbox`,checked:e.checked,onChange:e.onChange,"aria-label":e.label,className:`absolute h-3.5 w-3.5 rounded border-stone-300 text-[#3370ff] focus:ring-[#3370ff]/30 transition-opacity ${t?`opacity-100`:`opacity-0 group-hover/row:opacity-100`}`})]})]})})}function Je(e){return(0,W.jsxs)(ee,{open:e.open,onClose:e.onClose,transition:!0,className:`relative z-100`,children:[(0,W.jsx)(m,{transition:!0,className:`tw-dialog-backdrop-anim fixed inset-0 bg-black/25 duration-[280ms]`,"aria-hidden":`true`}),(0,W.jsx)(`div`,{className:`fixed inset-0 flex justify-end overflow-hidden`,children:(0,W.jsxs)(f,{transition:!0,className:`tw-drawer-panel-anim flex h-full w-full max-w-[520px] flex-col border-l border-stone-200 bg-white shadow-2xl duration-[280ms]`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-stone-100 px-6 py-4`,children:[(0,W.jsx)(p,{className:`text-base font-semibold text-stone-900`,children:e.title}),(0,W.jsx)(`button`,{type:`button`,onClick:e.onClose,"aria-label":`关闭`,className:`flex h-7 w-7 items-center justify-center rounded-md text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700`,children:`✕`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto py-3`,children:e.children}),e.footer?(0,W.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-stone-100 px-6 py-4`,children:e.footer}):null]})})]})}function Ye(e){return(0,W.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":e.label,className:`rounded p-1 text-stone-400 transition-colors hover:bg-stone-100 hover:text-stone-700 disabled:opacity-40`,children:(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,W.jsx)(`path`,{d:`M15 3h6v6`}),(0,W.jsx)(`path`,{d:`M9 21H3v-6`}),(0,W.jsx)(`path`,{d:`M21 3l-7 7`}),(0,W.jsx)(`path`,{d:`M3 21l7-7`})]})})}function Xe(e){return[...e].sort((e,t)=>{let n=e.updatedAt||e.createdAt||``;return(t.updatedAt||t.createdAt||``).localeCompare(n)})}function Ze(e){return[...e].sort((e,t)=>{let n=e.createdAt||``,r=t.createdAt||``;return n===r?String(e.id||``).localeCompare(String(t.id||``)):n.localeCompare(r)})}function Qe(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,r)=>{let i=n.get(e.status??``)??t.length,a=n.get(r.status??``)??t.length;if(i!==a)return i-a;let o=e.createdAt||``,s=r.createdAt||``;return o===s?String(e.id||``).localeCompare(String(r.id||``)):o.localeCompare(s)})}function $e(e,t){return e.objectives.find(e=>e.id===t)}var et={pending:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,overdue:`bg-[#fee4e3] text-[#c02a26]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,stalled:`bg-[#fff7d6] text-[#8a6100]`,closed:`bg-stone-100 text-stone-400`},tt={pending:`bg-stone-400`,in_progress:`bg-[#3370ff]`,overdue:`bg-[#f54a45]`,done:`bg-[#34c724]`,stalled:`bg-[#f7ba1e]`,closed:`bg-stone-300`},nt={pool:`bg-stone-100 text-stone-600`,in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,done:`bg-[#d9f5d2] text-[#1d7a12]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,closed:`bg-stone-100 text-stone-400`},rt={pool:`bg-stone-400`,in_progress:`bg-[#3370ff]`,done:`bg-[#34c724]`,incomplete:`bg-[#ff8800]`,closed:`bg-stone-300`},it={in_progress:`bg-[#e1eaff] text-[#1f4ec2]`,incomplete:`bg-[#fff1e3] text-[#a85b00]`,done:`bg-[#d9f5d2] text-[#1d7a12]`},at={in_progress:`bg-[#3370ff]`,incomplete:`bg-[#ff8800]`,done:`bg-[#34c724]`},ot={urgent_important:`bg-[#fee4e3] text-[#c02a26]`,important:`bg-[#fff1e3] text-[#a85b00]`,urgent:`bg-[#fff7d6] text-[#8a6100]`,normal:`bg-stone-100 text-stone-600`,"":`bg-stone-50 text-stone-400`},st={urgent_important:`bg-[#f54a45] text-white`,important:`bg-[#ff8800] text-white`,urgent:`bg-[#f7ba1e] text-stone-800`,normal:`bg-stone-200 text-stone-600`,"":`bg-transparent text-stone-400`},ct={urgent_important:`bg-[#f54a45]`,important:`bg-[#ff8800]`,urgent:`bg-[#f7ba1e]`,normal:`bg-stone-300`,"":`border border-stone-300 bg-transparent`},Z=[{cell:`bg-[#e1eaff] text-[#1f4ec2]`,pill:`bg-[#3370ff] text-white`},{cell:`bg-[#d9f5d2] text-[#1d7a12]`,pill:`bg-[#34c724] text-white`},{cell:`bg-[#fff1e3] text-[#a85b00]`,pill:`bg-[#ff8800] text-white`},{cell:`bg-[#e0f2fe] text-[#0369a1]`,pill:`bg-[#0ea5e9] text-white`},{cell:`bg-[#fce7f3] text-[#9d174d]`,pill:`bg-[#db2777] text-white`},{cell:`bg-[#ecfdf5] text-[#047857]`,pill:`bg-[#10b981] text-white`},{cell:`bg-[#fff7d6] text-[#8a6100]`,pill:`bg-[#f7ba1e] text-stone-800`},{cell:`bg-[#fee4e3] text-[#c02a26]`,pill:`bg-[#f54a45] text-white`}],lt={cell:`bg-stone-50 text-stone-400`,pill:`bg-stone-300 text-stone-600`};function ut(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}function Q(e){return e.trim()?Z[ut(e)%Z.length].cell:lt.cell}function dt(e){return!e.id.trim()||!e.label.trim()||e.label===`—`?(0,W.jsx)(`span`,{className:`text-sm text-stone-300`,children:e.emptyLabel??`—`}):(0,W.jsx)(`span`,{className:`inline-flex h-7 max-w-full items-center rounded-md px-2 text-xs font-medium ${Q(e.id)}`,children:(0,W.jsx)(g,{text:e.label,className:`block min-w-0 truncate`})})}var ft=`h-8 w-full min-w-0 truncate rounded-md border border-transparent bg-transparent px-1.5 text-sm text-stone-800 outline-none transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white placeholder:text-stone-300`;function $(e){let{value:t,placeholder:n,muted:r,autoFocus:i,onChange:a,onCommit:o,onCancel:s}=e;return(0,W.jsx)(`input`,{type:`text`,value:t,placeholder:n,autoFocus:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),s(),e.currentTarget.blur())},className:`${ft} ${r&&!t?`text-stone-300`:``}`})}function pt(e){let{value:t,onChange:n,onCommit:r,onCancel:i}=e,[a,o]=(0,_.useState)(!1);return a?(0,W.jsx)($,{value:t,placeholder:`—`,autoFocus:!0,onChange:n,onCommit:()=>{o(!1),r()},onCancel:()=>{o(!1),i()}}):(0,W.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`flex h-8 w-full min-w-0 items-center rounded-md border border-transparent px-1.5 text-left text-sm text-stone-700 transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:outline-none`,children:(0,W.jsx)(g,{text:t||`—`,className:`block min-w-0 truncate ${t?``:`text-stone-300`}`})})}function mt(e){return(0,W.jsx)(te,{value:e.value,onChange:e.onChange,placeholder:`选择日期`,className:`h-8 rounded-md border border-transparent px-1.5 text-sm text-stone-800 tabular-nums transition-colors hover:border-stone-200 focus:border-[#3370ff] focus:bg-white`})}function ht(e){return(0,W.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,"aria-busy":`true`,"aria-label":e.label??`正在加载`,children:(0,W.jsx)(`div`,{className:`flex min-h-[240px] flex-1 items-center justify-center`,children:(0,W.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})})})}function gt(e){return(0,W.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:e.children})}function _t(e){return(0,W.jsx)(`button`,{type:`button`,disabled:e.disabled,onClick:e.onClick,"aria-label":e.label,className:`tw-icon-danger rounded p-1`,children:(0,W.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,W.jsx)(`path`,{d:`M3 6h18`}),(0,W.jsx)(`path`,{d:`M8 6V4h8v2`}),(0,W.jsx)(`path`,{d:`M19 6l-1 14H6L5 6`}),(0,W.jsx)(`path`,{d:`M10 11v6M14 11v6`})]})})}function vt(e){return(0,W.jsx)(g,{text:e.text,className:`block min-w-0 truncate px-1.5 text-sm ${e.muted?`text-stone-300`:`text-stone-600`}`})}function yt(e){return e.error?(0,W.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,W.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.error}),(0,W.jsx)(`button`,{type:`button`,onClick:e.onDismiss,"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null}export{Te as $,Ke as A,Q as B,Me as C,N as Ct,We as D,gt as E,at as F,Ze as G,q as H,Ee as I,we as J,Qe as K,je as L,vt as M,$ as N,Ge as O,it as P,xe as Q,K as R,Ye as S,de as St,ht as T,J as U,be as V,$e as W,Ue as X,Ae as Y,Ce as Z,Ve as _,_e as _t,tt as a,re as at,Je as b,S as bt,He as c,A as ct,st as d,se as dt,Se as et,De as f,P as ft,Re as g,T as gt,Ie as h,U as ht,et as i,x as it,pt as j,qe as k,ot as l,k as lt,Le as m,F as mt,nt as n,oe as nt,Pe as o,ce as ot,Oe as p,ve as pt,Xe as q,rt as r,ne as rt,Fe as s,ae as st,mt as t,y as tt,ct as u,b as ut,dt as v,ge as vt,Be as w,w as wt,yt as x,ue as xt,_t as y,C as yt,ke as z};
@@ -1 +0,0 @@
1
- export{t as default}from"./PluginsPage.DE3qbeY5.js";
@@ -1 +0,0 @@
1
- import{s as e,t}from"./react.Blvh0GOs.js";import{i as n,p as r}from"./app-config.C4rpn1Ix.js";import{i,o as a,s as o}from"./plugins.C0NrHGZv.js";import{t as s}from"./jsx-runtime.DUg_B_vD.js";import{n as c,t as l}from"./DocsPager.BS20yicJ.js";import{t as u}from"./SelectDropdown.TgxIOKMD.js";import{showToast as d}from"./Toast.BO2NFckG.js";import{a as ee,c as te,i as ne,o as re,s as f,t as p}from"./report-prompt.CAfZ6RIo.js";var m=e(t(),1),h=`tw.reports.kind.v1`,g=Object.keys(p);function _(e){return typeof e==`string`&&g.includes(e)}function v(e=`day`){try{let t=localStorage.getItem(r(h));return _(t)?t:e}catch{return e}}function y(e){if(_(e))try{localStorage.setItem(r(h),e)}catch{}}var b=s(),x=[`day`,`week`,`month`],S=20,C=`tw.reports.page-size.v1`;function w(e){return e.replace(/\.(md|markdown|txt)$/i,``)}function T(e){return e.replace(/\.(md|markdown|txt|html?)$/i,``)}function E(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return`—`;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}/${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function ie(e){return!Number.isFinite(e)||e<=0?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}var ae={day:`日`,week:`周`,month:`月`};function D(){let[e,t]=(0,m.useState)(!1),[r,s]=(0,m.useState)(!0),[h,g]=(0,m.useState)(()=>v()),_=(0,m.useRef)(h),[D,O]=(0,m.useState)([]),[k,A]=(0,m.useState)(``),[j,M]=(0,m.useState)(!1),[N,P]=(0,m.useState)(null),[F,I]=(0,m.useState)(``),[L,R]=(0,m.useState)([]),[z,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(1),[G,K]=c(S,C),q=(0,m.useCallback)(async(e,t)=>{M(!0),P(null);try{if(t?.ensure)try{await te(!0)}catch{}let n=await ee(e);O(n.items),A(n.dir)}catch(e){let t=e instanceof Error?e.message:String(e);P(t.includes(`404`)?`工作汇报需要本地服务,当前未就绪(仅 npm run dev / 本地一体服务可用)。`:t),O([])}finally{M(!1)}},[]);(0,m.useEffect)(()=>{let e=a(e=>s(!!e.reports));return n().then(()=>{s(i(`reports`)),t(!0)}),e},[]);let J=(0,m.useCallback)(async()=>{try{let e=await ne();R(e.items),B(e.promptFile),e.promptFile||d(`没有读到「提示词管理」里的工作汇报提示词,写汇报前请先在提示词管理里补一份。`,`error`)}catch(e){let t=e instanceof Error?e.message:String(e);d(`读取工作汇报提示词失败:${t}`,`error`)}},[]);(0,m.useEffect)(()=>{e&&r&&(async()=>{await q(_.current,{ensure:!0}),await J()})()},[e,r,q,J]);function oe(e){y(e),e!==h&&(g(e),W(1),O([]),q(e))}async function se(e){if(e&&e!==z){H(!0),P(null);try{let t=await f(e);B(t),R(e=>e.map(e=>({...e,selected:e.name===t})))}catch(e){let t=e instanceof Error?e.message:String(e);P(t),d(`切换提示词失败:${t}`,`error`)}finally{H(!1)}}}let ce=(0,m.useMemo)(()=>L.length?L.map(e=>({value:e.name,label:w(e.name)})):[{value:``,label:`暂无提示词`}],[L]),Y=(0,m.useMemo)(()=>[...D].sort((e,t)=>t.generatedAt-e.generatedAt),[D]),X=Math.max(1,Math.ceil(Y.length/G)),Z=Math.min(U,X),le=(0,m.useMemo)(()=>Y.slice((Z-1)*G,Z*G),[Y,Z,G]),ue=`/workbench/?report=${h}`;async function Q(e){if(!F){I(e.name),P(null);try{await re(e.kind,e.name)}catch(e){P(e instanceof Error?e.message:String(e))}finally{I(``)}}}if(!e)return(0,b.jsx)(`div`,{className:`rounded-xl border border-stone-200 bg-white overflow-hidden flex items-center justify-center min-h-[220px]`,"aria-busy":`true`,"aria-label":`正在读取插件开关`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})});if(!r)return(0,b.jsx)(`div`,{className:`tw-lib-notice rounded-xl border border-amber-200 bg-amber-50 px-5 py-8 text-sm text-amber-900`,children:o(`reports`)});let $=Y[0];return(0,b.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-stone-200 bg-white`,children:[(0,b.jsxs)(`div`,{className:`shrink-0 border-b border-stone-100 px-4 py-3`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-stone-100/80 p-0.5`,children:x.map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>oe(e),className:`h-8 rounded-md px-3 text-sm transition-colors ${h===e?`bg-white font-medium text-stone-900 shadow-sm`:`text-stone-600 hover:text-stone-900`}`,children:p[e]},e))}),(0,b.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,b.jsx)(u,{className:`w-[172px]`,flat:!0,options:ce,value:z,onChange:e=>void se(e),disabled:!L.length||V,ariaLabel:`选择工作汇报提示词`,menuMinWidth:200}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>void(async()=>{await q(h),await J()})(),disabled:j,"aria-label":`刷新`,className:`flex h-9 w-9 items-center justify-center rounded-lg border border-stone-200 text-stone-500 transition-colors hover:bg-stone-50 hover:text-stone-800 disabled:opacity-40`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M21 12a9 9 0 1 1-3-6.7`}),(0,b.jsx)(`path`,{d:`M21 4v5h-5`})]})}),(0,b.jsx)(`a`,{href:ue,className:`inline-flex h-9 items-center whitespace-nowrap rounded-lg bg-[#3370ff] px-3 text-sm font-medium text-white transition-colors hover:bg-[#2b5fd9]`,children:`去工作台写汇报`})]})]}),(0,b.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-stone-400`,children:[(0,b.jsxs)(`span`,{children:[p[h],` · 共 `,D.length,` 篇`]}),$?(0,b.jsxs)(`span`,{className:`tabular-nums`,children:[`最近生成 `,E($.generatedAt)]}):null,(0,b.jsx)(`span`,{className:`min-w-0 truncate`,children:k||`—`}),(0,b.jsx)(`span`,{className:`ml-auto hidden shrink-0 sm:inline`,children:`点击卡片用系统默认程序打开`})]})]}),N?(0,b.jsxs)(`div`,{className:`mx-4 mt-3 flex shrink-0 items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700`,children:[(0,b.jsx)(`span`,{className:`min-w-0 flex-1`,children:N}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>P(null),"aria-label":`关闭`,className:`-mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-red-700/70 hover:bg-red-100 hover:text-red-900`,children:`✕`})]}):null,(0,b.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-stone-50/60 p-3 sm:p-4`,children:j&&D.length===0?(0,b.jsx)(`div`,{className:`flex min-h-[180px] items-center justify-center`,"aria-busy":`true`,children:(0,b.jsx)(`span`,{className:`tw-lib-spin`,"aria-hidden":`true`})}):D.length===0?(0,b.jsxs)(`div`,{className:`flex min-h-[260px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-stone-300 px-6 py-10 text-center`,children:[(0,b.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-xl bg-stone-100 text-stone-400`,children:(0,b.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`22`,height:`22`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,b.jsx)(`path`,{d:`M14 3v5h5`}),(0,b.jsx)(`path`,{d:`M9 13h6M9 17h4`})]})}),(0,b.jsxs)(`div`,{className:`text-sm font-medium text-stone-700`,children:[`还没有`,p[h]]}),(0,b.jsxs)(`p`,{className:`max-w-md text-xs leading-5 text-stone-400`,children:[`保存到 `,k||`工作汇报/${p[h]}`,` 后会自动出现在这里。`]})]}):(0,b.jsx)(`ul`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,380px),1fr))] gap-2.5`,children:le.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsxs)(`button`,{type:`button`,onClick:()=>void Q(e),disabled:!!F,className:`group flex w-full items-center gap-3 rounded-xl border border-stone-200 bg-white px-3.5 py-3 text-left transition-colors hover:border-[#3370ff]/50 hover:bg-stone-50 disabled:cursor-progress disabled:opacity-60`,children:[(0,b.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-stone-100 text-[13px] font-semibold text-stone-600`,children:ae[e.kind]}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`span`,{className:`block truncate text-sm font-medium text-stone-800 transition-colors group-hover:text-[#3370ff]`,children:T(e.name)}),(0,b.jsxs)(`span`,{className:`mt-0.5 block truncate text-xs text-stone-400 tabular-nums`,children:[E(e.generatedAt),` · `,ie(e.size)]})]}),(0,b.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 text-xs text-stone-400 transition-colors group-hover:text-[#3370ff]`,children:[F===e.name?`打开中…`:`打开`,(0,b.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,b.jsx)(`path`,{d:`m9 6 6 6-6 6`})})]})]})},e.name))})}),D.length>0?(0,b.jsx)(l,{page:Z,totalPages:X,pageSize:G,busy:j,onPage:W,onPageSize:e=>{K(e),W(1)}}):(0,b.jsx)(`div`,{className:`pb-2.5`})]})}export{D as default};
@@ -1 +0,0 @@
1
- var e=`0.1.35`;export{e as t};
@@ -1 +0,0 @@
1
- import{d as e,i as t,p as n}from"./app-config.C4rpn1Ix.js";import{s as r}from"./settings.NTeTjmxg.js";var i=`/__tb_sessions`,a=`tw-chat-sessions`,o=`tw-chat-active-id`,s=`tw-chat-history`,c=`tw-session-rail-open`,l=!1,u=null;function d(){return`s_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function f(e){let t=Date.now();return{id:d(),title:`新对话`,createdAt:t,updatedAt:t,archived:!1,pinned:!1,messages:[],...e}}function p(e){let t=(e.find(e=>e.role===`user`&&(e.content??``).trim())?.content??``).trim().replace(/\s+/g,` `);return t?t.length>24?`${t.slice(0,24)}…`:t:`新对话`}function m(){try{let e=localStorage.getItem(s);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function h(e){if(!e)return null;let t=(Array.isArray(e.sessions)?e.sessions:[]).filter(e=>!e.deleted);return t.length?{sessions:t,activeId:typeof e.activeId==`string`&&t.some(t=>t.id===e.activeId)?e.activeId:t.find(e=>!e.archived)?.id??t[0].id}:null}function g(){return n(a)}function _(){return n(o)}function v(){try{let e=localStorage.getItem(g());return e?h(JSON.parse(e)):null}catch{return null}}function y(e){try{localStorage.setItem(g(),JSON.stringify(e)),localStorage.setItem(_(),e.activeId)}catch{}}function b(){let e=m(),t=f({title:e.length?p(e):`新对话`,messages:e}),n={sessions:[t],activeId:t.id};try{localStorage.removeItem(s)}catch{}return n}async function x(e){let t=e?.preferSessionId?.trim()||``,n=v();try{let e=await fetch(i,{signal:AbortSignal.timeout(2e3)});if(e.ok){let r=await e.json();l=!0;let i=h(r.store??null);if(!i){let e=t&&n?n.sessions.find(e=>e.id===t):void 0;i=e?{sessions:[e],activeId:t}:b(),await C(i)}else if(t&&n&&!i.sessions.some(e=>e.id===t)){let e=n.sessions.find(e=>e.id===t);e?(i={...i,sessions:[e,...i.sessions],activeId:t},await C(i)):y(i)}else t&&i.sessions.some(e=>e.id===t)&&(i={...i,activeId:t}),y(i);return i}}catch{}return l=!1,n??b()}function S(){return v()??b()}async function C(e){if(y(e),l)try{await fetch(i,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({store:e})})}catch{}}function w(e){y(e),u&&clearTimeout(u),u=setTimeout(()=>{u=null,C(e)},320)}async function T(e){u&&=(clearTimeout(u),null),await C(e)}async function E(){if(!l)return null;try{let e=await fetch(i,{signal:AbortSignal.timeout(2e3)});return e.ok?h((await e.json()).store??null):null}catch{return null}}function D(e,t){let n=/<!--tb-schedule:([^>]+)-->/,r=!1,i=e.sessions.map(e=>{let i=t.sessions.find(t=>t.id===e.id);if(!i||!Array.isArray(i.messages))return e;let a=Array.isArray(e.messages)?[...e.messages]:[],o=new Set;for(let e of a){let t=e&&typeof e==`object`&&`content`in e?String(e.content??``):``,r=n.exec(t);r?.[1]&&o.add(r[1]);let i=e&&typeof e==`object`&&`scheduleId`in e?String(e.scheduleId??``):``;i&&o.add(i)}let s=!1;for(let e of i.messages){let t=e&&typeof e==`object`&&`content`in e?String(e.content??``):``,r=n.exec(t);r?.[1]&&!o.has(r[1])&&(a.push(e),o.add(r[1]),s=!0)}return s?(r=!0,{...e,messages:a,updatedAt:Date.now()}):e});return r?{...e,sessions:i}:e}function O(e,t){let n=f({workspacePath:t?.workspacePath,access:t?.access});return{sessions:[n,...e.sessions],activeId:n.id}}function k(e,t,n){let r=e.sessions.find(e=>e.id===t);if(!r)return e;let i=n?.titleSuffix??`(分叉)`,a=`${(r.title||`新对话`).replace(/(分叉)\s*$/,``).trim()||`新对话`}${i}`,o=f({title:a.length>40?`${a.slice(0,39)}…`:a,workspacePath:r.workspacePath,access:r.access,messages:Array.isArray(r.messages)?structuredClone(r.messages):[],archived:!1,pinned:!1,deleted:!1}),s=n?.activate!==!1;return{sessions:[o,...e.sessions],activeId:s?o.id:e.activeId}}function A(e,t,n){return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,workspacePath:n||void 0,updatedAt:Date.now()}:e)}}function j(e,t,n){let r=n.trim()||`未命名`;return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,title:r,updatedAt:Date.now()}:e)}}function M(e,t,n=!0){return{...e,sessions:e.sessions.map(e=>e.id===t?n&&e.archived?{...e,pinned:!0,archived:!1,updatedAt:Date.now()}:{...e,pinned:n,updatedAt:Date.now()}:e)}}function N(e,t){let n=e.sessions.filter(e=>e.id!==t);if(!n.length){let e=f();return{sessions:[e],activeId:e.id}}return{sessions:n,activeId:e.activeId===t?n.find(e=>!e.archived&&!e.deleted)?.id??n[0].id:e.activeId}}function P(e,t,n=!0){let r=e.sessions.map(e=>e.id===t?{...e,archived:n,deleted:!n&&e.deleted,pinned:!n&&e.pinned,updatedAt:Date.now()}:e),i=e.activeId;return n&&i===t&&(i=r.find(e=>!e.archived&&!e.deleted)?.id??r[0].id),{sessions:r,activeId:i}}function F(e,t){return{...e,sessions:e.sessions.map(e=>e.workspacePath===t?{...e,workspacePath:void 0,updatedAt:Date.now()}:e)}}function I(e){return!(e.archived||e.deleted||e.pinned||Array.isArray(e.messages)&&e.messages.length>0)}function L(e,t,n){let r=e;for(let i of e.sessions)t&&i.id===t||I(i)&&(n?.(i.id)||(r=N(r,i.id)));return t&&r.sessions.some(e=>e.id===t)&&r.activeId!==t&&(r={...r,activeId:t}),r}function R(e,t,n,r){let i=r?.touchUpdatedAt!==!1;return{...e,sessions:e.sessions.map(e=>{if(e.id!==t)return e;let a=r?.touchTitle&&(e.title===`新对话`||!e.title)||e.title===`新对话`?p(n):e.title;return{...e,messages:n.slice(-80),title:a,updatedAt:i?Date.now():e.updatedAt}})}}function z(e,t,n){return R(e,e.activeId,t,n)}function B(e){return Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return e;let t=e;return t.role!==`assistant`||!Array.isArray(t.activitySteps)||!t.activitySteps.some(e=>e.status===`running`)?e:{...t,activitySteps:t.activitySteps.map(e=>e.status===`running`?{...e,status:`done`}:e)}}):e}function V(e){let t=!1,n=e.sessions.map(e=>{let n=B(e.messages);return n===e.messages?e:(t=!0,{...e,messages:n})});return t?{...e,sessions:n}:e}function H(e,t,n){return{...e,sessions:e.sessions.map(e=>{if(e.id!==t)return e;let r=[...Array.isArray(e.messages)?e.messages:[],n].slice(-80);return{...e,messages:r,updatedAt:Date.now()}})}}function U(e,t,n){return{...e,sessions:e.sessions.map(e=>e.id===t?{...e,...n,updatedAt:Date.now()}:e)}}function W(e,t){return U(e,e.activeId,t)}function G(e,t){return e.sessions.some(e=>e.id===t)?{...e,activeId:t}:e}function K(e){return[...e].sort((e,t)=>{let n=+!!e.pinned,r=+!!t.pinned;return n===r?t.updatedAt-e.updatedAt:r-n})}function q(){try{return localStorage.getItem(n(c))!==`0`}catch{return!0}}function J(e){try{localStorage.setItem(n(c),e?`1`:`0`)}catch{}}function Y(t){let n=e();return n?`tb:session-handoff:${n}:${t}`:`tb:session-handoff:${t}`}function X(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/^\/+/,``)}function Z(e,t,n){return e.sessions.find(e=>{if(t===`cases`){let t=e.caseGen?.linkedCasePath;return!!(t&&X(t)===n)}let r=t===`prompts`?e.promptGen?.linkedPromptPath:e.knowledgeGen?.linkedKnowledgePath;return!!(r&&X(r)===n)})}async function Q(e,n){await x().catch(()=>null),await t().catch(()=>null);let i=S(),a=X(n.path),o=Z(i,e,a);if(o||=(i=O(i,{access:r()}),await T(i),i.sessions.find(e=>e.id===i.activeId)),!o)throw Error(`无法创建或定位会话`);try{let e=i.sessions.find(e=>e.id===o.id)??o;sessionStorage.setItem(Y(o.id),JSON.stringify({session:e}))}catch{}let s=new URLSearchParams({session:o.id,focusRoot:e,focusPath:a,attachRoot:e,attachPath:a,attachName:n.name});window.location.href=`/workbench/?${s.toString()}`}export{U as A,K as C,z as D,F as E,W as O,V as S,p as T,L as _,A as a,w as b,E as c,x as d,I as f,M as g,D as h,P as i,R as k,T as l,S as m,Y as n,O as o,q as p,H as r,N as s,Q as t,k as u,j as v,G as w,B as x,J as y};