@wrongstack/webui 0.281.1 → 0.282.0

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 (45) hide show
  1. package/dist/assets/{AnalyticsDashboard-Cb08RPms.js → AnalyticsDashboard-BrQc2ss-.js} +1 -1
  2. package/dist/assets/AutoPhaseView-8NTdnZ0a.js +1 -0
  3. package/dist/assets/{CodeEditor-CSTcX3Za.js → CodeEditor-C-pJLtUR.js} +1 -1
  4. package/dist/assets/{DebugDashboard-D6-znhBO.js → DebugDashboard-BHpiEOcf.js} +1 -1
  5. package/dist/assets/{DesignGalleryView-yKa55dpM.js → DesignGalleryView-M6Hp7s9b.js} +1 -1
  6. package/dist/assets/KanbanView-nMv98m0N.js +1 -0
  7. package/dist/assets/{MailboxDetailView-DbX_cNcu.js → MailboxDetailView-g3IQx4DB.js} +1 -1
  8. package/dist/assets/OfficeMapPanel-D3VE7UCd.js +4 -0
  9. package/dist/assets/{ProcessMonitor-DvPiHdzj.js → ProcessMonitor-CbfQYneY.js} +1 -1
  10. package/dist/assets/{QueuePanel-BVvnJXHh.js → QueuePanel-eGK1SSKx.js} +1 -1
  11. package/dist/assets/{RefreshDebugView-pmMPOier.js → RefreshDebugView-BXq2P3wo.js} +1 -1
  12. package/dist/assets/{SddBoardView-CGJbbRrh.js → SddBoardView-DvuH4f4e.js} +2 -2
  13. package/dist/assets/{SddFlowGraph-WW0qCx0t.js → SddFlowGraph-CtMpzU4S.js} +1 -1
  14. package/dist/assets/SddWizard-G55Yw9Bb.js +1 -0
  15. package/dist/assets/{SessionsDashboard-VwXvmSxS.js → SessionsDashboard-Dqsrp5CK.js} +1 -1
  16. package/dist/assets/SkillDetailView-CX9zeWBG.js +2 -0
  17. package/dist/assets/{SpecsView-BRdxB6rh.js → SpecsView-BnUsqkrG.js} +1 -1
  18. package/dist/assets/{TerminalPanel-CAcbPNO_.js → TerminalPanel-BCpddej2.js} +1 -1
  19. package/dist/assets/{chat-store-YPRVJGbn.js → chat-store-CIMOL6-x.js} +1 -1
  20. package/dist/assets/{i18n-BJCOtLro.js → i18n-CNo6A2vu.js} +1 -1
  21. package/dist/assets/index-BhO3caLf.js +146 -0
  22. package/dist/assets/index-D7_FeyCA.css +1 -0
  23. package/dist/assets/{session-store-Do0MGnXu.js → session-store-DN1UYDL9.js} +1 -1
  24. package/dist/assets/ui-store-BdOsq6T-.js +1 -0
  25. package/dist/assets/utils-DBns3uMk.js +1 -0
  26. package/dist/assets/{vendor-Bhf0nZ3B.js → vendor-Ch4m_qLI.js} +25 -25
  27. package/dist/assets/{ws-client-D9IQ9580.js → ws-client-BAV7SLzK.js} +1 -1
  28. package/dist/assets/{xyflow-Bp8EMwkC.js → xyflow-D5_yey7w.js} +3 -3
  29. package/dist/index.html +9 -9
  30. package/dist/index.js +6154 -5253
  31. package/dist/index.js.map +1 -1
  32. package/dist/server/entry.js +345 -13
  33. package/dist/server/entry.js.map +1 -1
  34. package/dist/server/index.js +345 -13
  35. package/dist/server/index.js.map +1 -1
  36. package/dist/types.d.ts +18 -3
  37. package/package.json +6 -6
  38. package/dist/assets/AutoPhaseView--Ec4Mom8.js +0 -1
  39. package/dist/assets/OfficeMapPanel-BMxzEv_S.js +0 -4
  40. package/dist/assets/SddWizard-Cen90k6M.js +0 -1
  41. package/dist/assets/SkillDetailView-CjUeZv6V.js +0 -2
  42. package/dist/assets/index-BSuiEQIC.js +0 -145
  43. package/dist/assets/index-CMiinLaB.css +0 -1
  44. package/dist/assets/ui-store-D3gGpJWY.js +0 -1
  45. package/dist/assets/utils-sFCTikqz.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Br as r,Nr as i,Qn as a,jr as o,lt as s,ni as c,nr as l,pt as u,rn as d,rt as f,si as p}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{t as m}from"./ws-client-D9IQ9580.js";import{R as h}from"./index-BSuiEQIC.js";var g=e(t(),1),_=n();function v(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function y(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function b(e){return e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function x(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function S(e){return e.includes(`error`)||e.includes(`fail`)?`text-red-400`:e.includes(`warn`)?`text-amber-400`:e.includes(`success`)||e.includes(`complete`)?`text-emerald-400`:`text-slate-400`}function C({icon:e,label:t,value:n,sub:r,color:i=`text-slate-300`}){return(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/50 p-4 flex items-start gap-3`,children:[(0,_.jsx)(`div`,{className:`mt-0.5 ${i}`,children:e}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums text-slate-100`,children:n}),(0,_.jsx)(`div`,{className:`text-xs text-slate-500 mt-0.5`,children:t}),r?(0,_.jsx)(`div`,{className:`text-xs text-slate-600 mt-1`,children:r}):null]})]})}function w(){let{t:e}=p(),[t,n]=(0,g.useState)(null),[w,T]=(0,g.useState)([]),[E,D]=(0,g.useState)([]),[O,k]=(0,g.useState)(null),[A,j]=(0,g.useState)(!0),[M,N]=(0,g.useState)(!1),P=(0,g.useRef)(null),F=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/analytics/summary`);e.ok&&n(await e.json())}catch{}},[]),I=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/analytics?limit=50`);e.ok&&T((await e.json()).events)}catch{}},[]),L=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);e.ok&&D(await e.json())}catch{}},[]),R=(0,g.useCallback)(async()=>{if(!M){N(!0);try{let e=m(h.getState().wsUrl);P.current=e;let t=e.on(`stats.get`,e=>{let n=e.payload;k(n),N(!1),t()});e.getStats(),setTimeout(()=>{N(!1),t()},8e3)}catch{N(!1)}}},[M]);(0,g.useEffect)(()=>{let e=()=>{Promise.all([F(),I(),L(),R()]).finally(()=>j(!1))};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[F,I,L,R]);let{totalAgents:z,activeAgents:B,totalToolCalls:V,totalIterations:H}=(0,g.useMemo)(()=>{let e=0,t=0,n=0,r=0;for(let i of E)for(let a of i.agents)e++,a.status===`running`&&t++,n+=a.toolCalls,r+=a.iterations;return{totalAgents:e,activeAgents:t,totalToolCalls:n,totalIterations:r}},[E]),U=(0,g.useMemo)(()=>t?Object.entries(t.categoryBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,8):[],[t]),W=(0,g.useMemo)(()=>t?Object.entries(t.eventBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,10):[],[t]),G=(0,g.useMemo)(()=>{if(!t)return 0;let e=0;for(let[n,r]of Object.entries(t.eventBreakdown))n.toLowerCase().includes(`error`)&&(e+=r);return e},[t]),K=(0,g.useMemo)(()=>{if(!t)return 0;let e=0;for(let[n,r]of Object.entries(t.eventBreakdown))n.toLowerCase().includes(`warn`)&&(e+=r);return e},[t]),q=(0,g.useMemo)(()=>[...w].reverse(),[w]);return A?(0,_.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-slate-400`,children:[(0,_.jsx)(r,{className:`h-4 w-4 animate-spin`}),e(`activity:analytics.loading`)]}):(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,_.jsx)(`div`,{className:`shrink-0 px-4 pt-3 pb-2 border-b border-slate-700/50`,children:(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-cyan-400`}),(0,_.jsx)(`h1`,{className:`text-sm font-semibold text-slate-200 uppercase tracking-wider`,children:e(`activity:analytics.heading`)})]}),(0,_.jsx)(`span`,{className:`text-xs text-slate-600`,children:e(`activity:analytics.autoRefresh`)})]})}),(0,_.jsxs)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3`,children:[(0,_.jsx)(C,{icon:(0,_.jsx)(o,{className:`h-4 w-4`}),label:e(`activity:analytics.liveSessions`),value:E.length,color:`text-cyan-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(f,{className:`h-4 w-4`}),label:e(`activity:analytics.agents`),value:`${B}/${z}`,sub:B>0?e(`activity:analytics.agentsActive`,{count:B}):void 0,color:`text-blue-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(d,{className:`h-4 w-4`}),label:e(`activity:analytics.totalEvents`),value:t?.totalEvents??0,sub:e(`activity:analytics.categoriesSub`,{count:t?.uniqueCategories??0}),color:`text-violet-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(u,{className:`h-4 w-4`}),label:e(`activity:analytics.toolCalls`),value:V,sub:e(`activity:analytics.iterationsSub`,{count:H}),color:`text-emerald-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(a,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionCost`),value:O?b(O.cost):`—`,sub:O?e(`activity:analytics.tokensSub`,{input:y(O.usage.input),output:y(O.usage.output)}):void 0,color:`text-amber-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(l,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionDuration`),value:O?v(O.elapsedMs):`—`,sub:O?e(`activity:analytics.messagesSub`,{count:O.messages}):void 0,color:`text-rose-400`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(s,{className:`h-3.5 w-3.5 text-cyan-400`}),e(`activity:analytics.eventsByCategory`)]}),U.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noEvents`)}):(0,_.jsx)(`div`,{className:`space-y-1.5`,children:U.map(([e,t])=>{let n=U[0]?.[1]??1,r=Math.round(t/n*100);return(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`w-28 shrink-0 truncate text-slate-300`,children:e}),(0,_.jsx)(`div`,{className:`flex-1 h-4 bg-slate-700/50 rounded-full overflow-hidden`,children:(0,_.jsx)(`div`,{className:`h-full bg-cyan-500/60 rounded-full transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,_.jsx)(`span`,{className:`w-10 text-right tabular-nums text-slate-400`,children:t})]},e)})})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(c,{className:`h-3.5 w-3.5 text-violet-400`}),e(`activity:analytics.topEvents`)]}),W.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noEvents`)}):(0,_.jsx)(`div`,{className:`space-y-1.5`,children:W.map(([e,t])=>{let n=W[0]?.[1]??1,r=Math.round(t/n*100);return(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`w-36 shrink-0 truncate ${S(e)}`,children:e}),(0,_.jsx)(`div`,{className:`flex-1 h-4 bg-slate-700/50 rounded-full overflow-hidden`,children:(0,_.jsx)(`div`,{className:`h-full bg-violet-500/60 rounded-full transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,_.jsx)(`span`,{className:`w-10 text-right tabular-nums text-slate-400`,children:t})]},e)})})]})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(a,{className:`h-3.5 w-3.5 text-amber-400`}),e(`activity:analytics.activeSessionUsage`)]}),O?(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.provider`)}),(0,_.jsx)(`p`,{className:`text-slate-200 font-mono mt-0.5`,children:O.provider})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.model`)}),(0,_.jsx)(`p`,{className:`text-slate-200 font-mono mt-0.5`,children:O.model})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.inputTokens`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:y(O.usage.input)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.outputTokens`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:y(O.usage.output)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.cacheRatio`)}),(0,_.jsxs)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:[(O.cache.ratio*100).toFixed(1),`%`]})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.filesRead`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:O.readFiles})]})]}):(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noSession`)})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(i,{className:`h-3.5 w-3.5 text-amber-400`}),e(`activity:analytics.healthErrors`)]}),(0,_.jsx)(`div`,{className:`space-y-2 text-xs`,children:t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.errorEvents`)}),(0,_.jsx)(`span`,{className:`text-red-400 tabular-nums`,children:G})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.warningEvents`)}),(0,_.jsx)(`span`,{className:`text-amber-400 tabular-nums`,children:K})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.cacheHitRate`)}),(0,_.jsx)(`span`,{className:`text-emerald-400 tabular-nums`,children:O?`${(O.cache.ratio*100).toFixed(1)}%`:`—`})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.totalCategories`)}),(0,_.jsx)(`span`,{className:`text-slate-300 tabular-nums`,children:t.uniqueCategories})]})]}):(0,_.jsx)(`p`,{className:`text-slate-600`,children:e(`activity:analytics.waitingData`)})})]})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(o,{className:`h-3.5 w-3.5 text-cyan-400`}),e(`activity:analytics.recentEvents`)]}),w.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noRecentEvents`)}):(0,_.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1`,children:q.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-start gap-2 py-1 px-2 rounded hover:bg-slate-700/30 text-xs`,children:[(0,_.jsx)(`span`,{className:`text-slate-600 tabular-nums shrink-0 w-16`,children:x(e.timestamp)}),(0,_.jsx)(`span`,{className:`shrink-0 w-24 truncate ${S(e.event)}`,children:e.event}),(0,_.jsx)(`span`,{className:`text-slate-500 shrink-0 w-20 truncate`,children:e.category}),(0,_.jsx)(`span`,{className:`text-slate-400 truncate`,children:e.label??e.sessionId??``})]},`${e.timestamp}-${t}`))})]})]})]})}export{w as AnalyticsDashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{$n as r,Mr as i,Pr as a,Vr as o,ci as s,in as c,lt as l,pt as u,ri as d,rr as f,rt as p}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as m}from"./ws-client-BAV7SLzK.js";import{R as h}from"./index-BhO3caLf.js";var g=e(t(),1),_=n();function v(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function y(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function b(e){return e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function x(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function S(e){return e.includes(`error`)||e.includes(`fail`)?`text-red-400`:e.includes(`warn`)?`text-amber-400`:e.includes(`success`)||e.includes(`complete`)?`text-emerald-400`:`text-slate-400`}function C({icon:e,label:t,value:n,sub:r,color:i=`text-slate-300`}){return(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/50 p-4 flex items-start gap-3`,children:[(0,_.jsx)(`div`,{className:`mt-0.5 ${i}`,children:e}),(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums text-slate-100`,children:n}),(0,_.jsx)(`div`,{className:`text-xs text-slate-500 mt-0.5`,children:t}),r?(0,_.jsx)(`div`,{className:`text-xs text-slate-600 mt-1`,children:r}):null]})]})}function w(){let{t:e}=s(),[t,n]=(0,g.useState)(null),[w,T]=(0,g.useState)([]),[E,D]=(0,g.useState)([]),[O,k]=(0,g.useState)(null),[A,j]=(0,g.useState)(!0),[M,N]=(0,g.useState)(!1),P=(0,g.useRef)(null),F=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/analytics/summary`);e.ok&&n(await e.json())}catch{}},[]),I=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/analytics?limit=50`);e.ok&&T((await e.json()).events)}catch{}},[]),L=(0,g.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);e.ok&&D(await e.json())}catch{}},[]),R=(0,g.useCallback)(async()=>{if(!M){N(!0);try{let e=m(h.getState().wsUrl);P.current=e;let t=e.on(`stats.get`,e=>{let n=e.payload;k(n),N(!1),t()});e.getStats(),setTimeout(()=>{N(!1),t()},8e3)}catch{N(!1)}}},[M]);(0,g.useEffect)(()=>{let e=()=>{Promise.all([F(),I(),L(),R()]).finally(()=>j(!1))};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[F,I,L,R]);let{totalAgents:z,activeAgents:B,totalToolCalls:V,totalIterations:H}=(0,g.useMemo)(()=>{let e=0,t=0,n=0,r=0;for(let i of E)for(let a of i.agents)e++,a.status===`running`&&t++,n+=a.toolCalls,r+=a.iterations;return{totalAgents:e,activeAgents:t,totalToolCalls:n,totalIterations:r}},[E]),U=(0,g.useMemo)(()=>t?Object.entries(t.categoryBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,8):[],[t]),W=(0,g.useMemo)(()=>t?Object.entries(t.eventBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,10):[],[t]),G=(0,g.useMemo)(()=>{if(!t)return 0;let e=0;for(let[n,r]of Object.entries(t.eventBreakdown))n.toLowerCase().includes(`error`)&&(e+=r);return e},[t]),K=(0,g.useMemo)(()=>{if(!t)return 0;let e=0;for(let[n,r]of Object.entries(t.eventBreakdown))n.toLowerCase().includes(`warn`)&&(e+=r);return e},[t]),q=(0,g.useMemo)(()=>[...w].reverse(),[w]);return A?(0,_.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-slate-400`,children:[(0,_.jsx)(o,{className:`h-4 w-4 animate-spin`}),e(`activity:analytics.loading`)]}):(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,_.jsx)(`div`,{className:`shrink-0 px-4 pt-3 pb-2 border-b border-slate-700/50`,children:(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(d,{className:`h-4 w-4 text-cyan-400`}),(0,_.jsx)(`h1`,{className:`text-sm font-semibold text-slate-200 uppercase tracking-wider`,children:e(`activity:analytics.heading`)})]}),(0,_.jsx)(`span`,{className:`text-xs text-slate-600`,children:e(`activity:analytics.autoRefresh`)})]})}),(0,_.jsxs)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3`,children:[(0,_.jsx)(C,{icon:(0,_.jsx)(i,{className:`h-4 w-4`}),label:e(`activity:analytics.liveSessions`),value:E.length,color:`text-cyan-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(p,{className:`h-4 w-4`}),label:e(`activity:analytics.agents`),value:`${B}/${z}`,sub:B>0?e(`activity:analytics.agentsActive`,{count:B}):void 0,color:`text-blue-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(c,{className:`h-4 w-4`}),label:e(`activity:analytics.totalEvents`),value:t?.totalEvents??0,sub:e(`activity:analytics.categoriesSub`,{count:t?.uniqueCategories??0}),color:`text-violet-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(u,{className:`h-4 w-4`}),label:e(`activity:analytics.toolCalls`),value:V,sub:e(`activity:analytics.iterationsSub`,{count:H}),color:`text-emerald-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(r,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionCost`),value:O?b(O.cost):`—`,sub:O?e(`activity:analytics.tokensSub`,{input:y(O.usage.input),output:y(O.usage.output)}):void 0,color:`text-amber-400`}),(0,_.jsx)(C,{icon:(0,_.jsx)(f,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionDuration`),value:O?v(O.elapsedMs):`—`,sub:O?e(`activity:analytics.messagesSub`,{count:O.messages}):void 0,color:`text-rose-400`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(l,{className:`h-3.5 w-3.5 text-cyan-400`}),e(`activity:analytics.eventsByCategory`)]}),U.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noEvents`)}):(0,_.jsx)(`div`,{className:`space-y-1.5`,children:U.map(([e,t])=>{let n=U[0]?.[1]??1,r=Math.round(t/n*100);return(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`w-28 shrink-0 truncate text-slate-300`,children:e}),(0,_.jsx)(`div`,{className:`flex-1 h-4 bg-slate-700/50 rounded-full overflow-hidden`,children:(0,_.jsx)(`div`,{className:`h-full bg-cyan-500/60 rounded-full transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,_.jsx)(`span`,{className:`w-10 text-right tabular-nums text-slate-400`,children:t})]},e)})})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(d,{className:`h-3.5 w-3.5 text-violet-400`}),e(`activity:analytics.topEvents`)]}),W.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noEvents`)}):(0,_.jsx)(`div`,{className:`space-y-1.5`,children:W.map(([e,t])=>{let n=W[0]?.[1]??1,r=Math.round(t/n*100);return(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,_.jsx)(`span`,{className:`w-36 shrink-0 truncate ${S(e)}`,children:e}),(0,_.jsx)(`div`,{className:`flex-1 h-4 bg-slate-700/50 rounded-full overflow-hidden`,children:(0,_.jsx)(`div`,{className:`h-full bg-violet-500/60 rounded-full transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,_.jsx)(`span`,{className:`w-10 text-right tabular-nums text-slate-400`,children:t})]},e)})})]})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(r,{className:`h-3.5 w-3.5 text-amber-400`}),e(`activity:analytics.activeSessionUsage`)]}),O?(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.provider`)}),(0,_.jsx)(`p`,{className:`text-slate-200 font-mono mt-0.5`,children:O.provider})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.model`)}),(0,_.jsx)(`p`,{className:`text-slate-200 font-mono mt-0.5`,children:O.model})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.inputTokens`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:y(O.usage.input)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.outputTokens`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:y(O.usage.output)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.cacheRatio`)}),(0,_.jsxs)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:[(O.cache.ratio*100).toFixed(1),`%`]})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.filesRead`)}),(0,_.jsx)(`p`,{className:`text-slate-200 tabular-nums mt-0.5`,children:O.readFiles})]})]}):(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noSession`)})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(a,{className:`h-3.5 w-3.5 text-amber-400`}),e(`activity:analytics.healthErrors`)]}),(0,_.jsx)(`div`,{className:`space-y-2 text-xs`,children:t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.errorEvents`)}),(0,_.jsx)(`span`,{className:`text-red-400 tabular-nums`,children:G})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.warningEvents`)}),(0,_.jsx)(`span`,{className:`text-amber-400 tabular-nums`,children:K})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.cacheHitRate`)}),(0,_.jsx)(`span`,{className:`text-emerald-400 tabular-nums`,children:O?`${(O.cache.ratio*100).toFixed(1)}%`:`—`})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{className:`text-slate-500`,children:e(`activity:analytics.totalCategories`)}),(0,_.jsx)(`span`,{className:`text-slate-300 tabular-nums`,children:t.uniqueCategories})]})]}):(0,_.jsx)(`p`,{className:`text-slate-600`,children:e(`activity:analytics.waitingData`)})})]})]}),(0,_.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-800/30 p-4`,children:[(0,_.jsxs)(`h3`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider mb-3 flex items-center gap-2`,children:[(0,_.jsx)(i,{className:`h-3.5 w-3.5 text-cyan-400`}),e(`activity:analytics.recentEvents`)]}),w.length===0?(0,_.jsx)(`p`,{className:`text-slate-600 text-xs`,children:e(`activity:analytics.noRecentEvents`)}):(0,_.jsx)(`div`,{className:`max-h-64 overflow-y-auto space-y-1`,children:q.map((e,t)=>(0,_.jsxs)(`div`,{className:`flex items-start gap-2 py-1 px-2 rounded hover:bg-slate-700/30 text-xs`,children:[(0,_.jsx)(`span`,{className:`text-slate-600 tabular-nums shrink-0 w-16`,children:x(e.timestamp)}),(0,_.jsx)(`span`,{className:`shrink-0 w-24 truncate ${S(e.event)}`,children:e.event}),(0,_.jsx)(`span`,{className:`text-slate-500 shrink-0 w-20 truncate`,children:e.category}),(0,_.jsx)(`span`,{className:`text-slate-400 truncate`,children:e.label??e.sessionId??``})]},`${e.timestamp}-${t}`))})]})]})]})}export{w as AnalyticsDashboard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CIMOL6-x.js";import{m as n,p as r}from"./markdown-D0X23O-i.js";import{$r as i,Hr as a,Ht as o,It as s,Lr as c,Lt as l,Ut as u,Vr as d,X as f,Xr as p,Z as m,bt as h,ci as g,ct as _,di as v,lr as y,ot as b,qt as x,sr as S,ti as C}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as w}from"./utils-DBns3uMk.js";import{C as T,E,T as D,n as ee,p as O,r as k,s as A,t as j,z as M}from"./index-BhO3caLf.js";var N=e(n(),1),P=r(),F={pending:{icon:(0,P.jsx)(y,{className:`w-4 h-4`}),color:`text-muted-foreground`,label:`Pending`},in_progress:{icon:(0,P.jsx)(S,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,P.jsx)(x,{className:`w-4 h-4`}),color:`text-[hsl(var(--warning))]`,label:`Blocked`},failed:{icon:(0,P.jsx)(i,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,P.jsx)(s,{className:`w-4 h-4`}),color:`text-[hsl(var(--info))]`,label:`Review`},completed:{icon:(0,P.jsx)(C,{className:`w-4 h-4`}),color:`text-[hsl(var(--success))]`,label:`Done`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-orange-500/15 text-orange-600 dark:text-orange-400`,medium:`bg-[hsl(var(--info)/0.15)] text-[hsl(var(--info))]`,low:`bg-muted text-muted-foreground`},L={feature:`bg-[hsl(var(--success)/0.15)] text-[hsl(var(--success))]`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-violet-500/15 text-violet-600 dark:text-violet-400`,docs:`bg-sky-500/15 text-sky-600 dark:text-sky-400`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:n,agents:r,onAssign:i,compact:a,className:o}){let{t:c}=g(),l=F[e.status],[u,d]=(0,N.useState)(!1),f=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:w(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,f?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-[hsl(var(--success)/0.35)] bg-[hsl(var(--success)/0.06)]`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,o),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:w(`mt-0.5`,l.color),"aria-label":f?c(`common:status.inProgress`):void 0,children:l.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:w(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,f?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[f&&(0,P.jsx)(S,{className:`w-3 h-3 animate-spin`,"aria-label":c(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!a&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:c(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-[hsl(var(--success)/0.15)] text-[hsl(var(--success))] hover:bg-[hsl(var(--success)/0.25)] transition-colors`,children:c(`activity:task.complete`)}),n&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(s,{className:`w-3 h-3`}),` `,c(`activity:task.retry`)]}),i&&r&&r.length>0&&(u?(0,P.jsxs)(`select`,{autoFocus:!0,defaultValue:e.assignee??``,onChange:t=>{i(e.id,t.target.value),d(!1)},onBlur:()=>d(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:c(`activity:task.unassigned`)}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:c(`activity:task.assignTitle`),children:[(0,P.jsx)(b,{className:`w-3 h-3`}),` `,c(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,label:`Pending`,match:[`pending`,`blocked`]},{key:`in_progress`,label:`In Progress`,match:[`in_progress`]},{key:`review`,label:`Review`,match:[`review`]},{key:`failed`,label:`Failed`,match:[`failed`]},{key:`completed`,label:`Done`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-[hsl(var(--info)/0.15)] text-[hsl(var(--info))]`,running:`bg-primary/15 text-primary`,paused:`bg-amber-500/15 text-amber-600 dark:text-amber-400`,completed:`bg-[hsl(var(--success)/0.15)] text-[hsl(var(--success))]`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function H(){let{client:e}=T(),{t}=g(),n=M(e=>e.phases),[r,i]=(0,N.useState)(`phase`),[a,s]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),d=(0,N.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),f=(0,N.useMemo)(()=>[...new Set(d.map(e=>e.assignee).filter(e=>!!e))],[d]),m=(0,N.useCallback)(t=>e?.send?.(t),[e]),h=(0,N.useCallback)((e,t)=>m({type:`autophase.taskStatus`,payload:{taskId:e,status:t}}),[m]),_=(0,N.useCallback)(e=>m({type:`autophase.retryTask`,payload:{taskId:e}}),[m]),v=(0,N.useCallback)((e,t)=>m({type:`autophase.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[m]),y=(0,N.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&m({type:`autophase.addTask`,payload:{phaseId:e,title:t}})})},[m]),b=(0,N.useCallback)(e=>{a&&m({type:`autophase.moveTask`,payload:{taskId:a,toPhaseId:e}}),s(null),u(null)},[a,m]),x=(0,N.useCallback)(e=>{a&&m({type:`autophase.taskStatus`,payload:{taskId:a,status:e}}),s(null),u(null)},[a,m]),S={onStatusChange:h,onRetry:_,agents:f,onAssign:v};function C(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),u(null)}}}function E(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&u(e)},onDragLeave:()=>u(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===e||void 0}}return n.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:d.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(`phase`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,r===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(p,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(`status`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,r===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:n.map(e=>{let n=d.filter(t=>t.phaseId===e.id);return(0,P.jsxs)(`div`,{...E(`phase:${e.id}`,()=>b(e.id)),className:w(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:w(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),title:t(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(o,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2`,children:n.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:t(`activity:board.dropHere`)}):n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:w(a===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...S})},e.id))})]},e.id)})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:t(`activity:board.status.${e.key}`)},e.key)),n.map(e=>(0,P.jsxs)(U,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=d.filter(n=>n.phaseId===e.id&&t.match.includes(n.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...E(r,()=>x(t.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,l===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:w(a===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...S})},e.id))},t.key)})]},e.id))]})})]})}function U({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function W({onClose:e}){let{client:n}=T(),{t:r}=g(),i=M(e=>e.phases),s=M(e=>e.overallPercent),c=M(e=>e.autonomous),p=M(e=>e.title),y=M(e=>e.goal),b=M(e=>e.status),S=M(e=>e.lastError),C=M(e=>e.graphs);(0,N.useEffect)(()=>{n?.send?.({type:`autophase.list`}),n?.send?.({type:`autophase.state`})},[n]);let A=E(e=>e.worktrees),F=E(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[U,W]=(0,N.useState)(!0),G=i.length>0,K=R!=null&&!G;(0,N.useEffect)(()=>{G&&z(null)},[G]);let q=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:v.t(`activity:autoPhase.planningAck`)}),z(e),L(``),n?.send?.({type:`autophase.start`,payload:{title:e,autonomous:!0,worktrees:U}}),D(`chat`)},[I,R,n,U]),J=(0,N.useCallback)(()=>{n?.send?.({type:`autophase.stop`,payload:{}}),z(null)},[n]),Y=(0,N.useCallback)(()=>{n?.send?.({type:`autophase.toggleAutonomous`,payload:{}})},[n]),X=(0,N.useCallback)(()=>{n?.send?.(b===`paused`?{type:`autophase.resume`,payload:{}}:{type:`autophase.pause`,payload:{}})},[n,b]),Z=(0,N.useCallback)(()=>{n?.send?.({type:`autophase.stop`,payload:{}})},[n]),Q=(0,N.useCallback)(()=>{n?.send?.({type:`autophase.clear`,payload:{}}),M.getState().clear(),z(null),L(``)},[n]),[te,$]=(0,N.useState)(!1),ne=(0,N.useCallback)(()=>{n?.send?.({type:`autophase.revert`,payload:{}}),$(!1)},[n]),re=b===`running`||b===`paused`,ie=b===`stopped`||b===`completed`||b===`failed`,ae=(0,N.useCallback)(e=>{e&&n?.send?.({type:`autophase.load`,payload:{graphId:e}})},[n]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex items-center justify-between px-4 py-2 border-b bg-card shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(a,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:G&&p||`AutoPhase`}),G&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:autoPhase.summary`,{count:i.length,pct:s})})]}),G&&(0,P.jsx)(`span`,{className:w(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,b===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:b===`paused`||b===`stopped`?`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300`:b===`completed`?`border-green-500/40 bg-green-500/10 text-green-700 dark:text-green-300`:`border-primary/30 bg-primary/10 text-primary`),title:S??void 0,children:b})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C.length>0&&(0,P.jsxs)(`select`,{value:G?C.find(e=>e.title===p)?.id??``:``,onChange:e=>ae(e.target.value),title:r(`activity:autoPhase.switchBoard`),className:`rounded border border-border bg-card px-2 py-1 text-xs text-foreground`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:r(`activity:autoPhase.boardsCount`,{count:C.length})}),C.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),G&&(0,P.jsxs)(`button`,{type:`button`,onClick:Y,title:r(`activity:autoPhase.toggleAutonomousTitle`),className:w(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,c?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(f,{className:`h-3.5 w-3.5`}),` `,r(c?`activity:autoPhase.autonomous`:`activity:autoPhase.manual`)]}),re&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:X,title:r(b===`paused`?`activity:autoPhase.resumeTitle`:`activity:autoPhase.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[b===`paused`?(0,P.jsx)(u,{className:`h-3.5 w-3.5`}):(0,P.jsx)(x,{className:`h-3.5 w-3.5`}),r(b===`paused`?`activity:autoPhase.resume`:`activity:autoPhase.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:Z,title:r(`activity:autoPhase.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(h,{className:`h-3.5 w-3.5 fill-current`}),` `,r(`activity:autoPhase.stop`)]})]}),G&&ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:Q,title:r(`activity:autoPhase.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(o,{className:`h-3.5 w-3.5`}),` `,r(`activity:autoPhase.newLabel`)]}),te?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-amber-700 dark:text-amber-300`,children:r(`activity:autoPhase.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:ne,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:r(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:r(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:r(`activity:autoPhase.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),` `,r(`activity:autoPhase.revert`)]})]}),(0,P.jsx)(O,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(m,{className:`h-4 w-4`})})]})]}),G&&y&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(l,{className:`h-3 w-3`}),` `,r(`activity:autoPhase.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:y})]}),G?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(H,{})}):K?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(d,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:r(`activity:autoPhase.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`activity:autoPhase.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(l,{className:`h-3 w-3`}),` `,r(`activity:autoPhase.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(O,{variant:`outline`,onClick:J,className:`gap-2`,children:[(0,P.jsx)(h,{className:`h-4 w-4 fill-current`}),` `,r(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(l,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:r(`activity:autoPhase.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`activity:autoPhase.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:r(`activity:autoPhase.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/50`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),q())}}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),r(`activity:autoPhase.isolateLabel`)]}),(0,P.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,P.jsxs)(O,{onClick:q,disabled:!I.trim(),className:`flex-1 gap-2`,children:[(0,P.jsx)(u,{className:`h-4 w-4`}),r(`activity:autoPhase.startButton`)]})}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[r(`activity:autoPhase.ctrlHint`),` ·`,` `,r(U?`activity:autoPhase.isolateOn`:`activity:autoPhase.isolateOff`)]})]})}),A.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:w(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:r(`activity:autoPhase.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:w(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:r(`activity:autoPhase.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(j,{}),B?(0,P.jsx)(k,{worktrees:A,baseBranch:F}):(0,P.jsx)(ee,{worktrees:A,baseBranch:F})]})]})]})}export{W as AutoPhaseView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Hn as r,Z as i,cr as a,jt as o,si as s}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{a as c,c as l,i as u,n as d,o as f,r as p,t as m}from"./monaco-DqY9Mr3N.js";import{t as h}from"./ws-client-D9IQ9580.js";import{t as g}from"./utils-sFCTikqz.js";import{O as _,R as v,S as y,T as b,b as x,k as S}from"./index-BSuiEQIC.js";var C={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},w=Array.from(new Set(Object.values(C))).filter(e=>e!==`plaintext`),T=12e3,E=4e3,D=5e3,O=1e4;function k(e){return C[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function A(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function j(e,t){return e.triggerCharacter?!0:t.length>=3}function M(e,t){return e.triggerCharacter===`.`?!0:e.triggerCharacter?!1:/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function N(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}var P=e(t(),1),F=n();l.config({monaco:m});function I(e){switch(e){case`method`:return c.CompletionItemKind.Method;case`function`:return c.CompletionItemKind.Function;case`constructor`:return c.CompletionItemKind.Constructor;case`field`:return c.CompletionItemKind.Field;case`variable`:return c.CompletionItemKind.Variable;case`class`:return c.CompletionItemKind.Class;case`interface`:return c.CompletionItemKind.Interface;case`module`:return c.CompletionItemKind.Module;case`property`:return c.CompletionItemKind.Property;case`unit`:return c.CompletionItemKind.Unit;case`value`:return c.CompletionItemKind.Value;case`enum`:return c.CompletionItemKind.Enum;case`keyword`:return c.CompletionItemKind.Keyword;case`snippet`:return c.CompletionItemKind.Snippet;case`file`:return c.CompletionItemKind.File;case`reference`:return c.CompletionItemKind.Reference;default:return c.CompletionItemKind.Text}}function L(){let e=S(e=>e.openFiles),t=S(e=>e.activeFilePath),n=S(e=>e.setActiveFile),r=S(e=>e.closeFile);return e.length===0?null:(0,F.jsx)(`div`,{className:`flex items-center border-b bg-muted/40 overflow-x-auto shrink-0`,children:e.map(e=>{let o=e.path===t,s=e.path.split(`/`).pop()??e.path;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),r(e.path))},className:g(`group flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r whitespace-nowrap min-w-0 max-w-[180px] transition-colors`,o?`bg-background border-t-2 border-t-primary text-foreground -mb-px`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),title:e.path,children:[e.dirty&&(0,F.jsx)(a,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:s}),(0,F.jsx)(i,{className:g(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,o&&`opacity-100`),onClick:t=>{t.stopPropagation(),r(e.path)}})]},e.path)})})}function R(){let{t:e}=s(),t=S(e=>e.openFiles),n=S(e=>e.activeFilePath),i=S(e=>e.updateContent),{theme:a}=y(),l=(0,P.useRef)(null),m=(0,P.useRef)(n),g=(0,P.useRef)(new Map),C=(0,P.useMemo)(()=>t.find(e=>e.path===n)??null,[t,n]),R=n?k(n):`plaintext`,z=x(),[B,V]=(0,P.useState)(!1);(0,P.useEffect)(()=>{m.current=n},[n]),(0,P.useEffect)(()=>{let e=x();u.setTheme(e)},[a]),(0,P.useEffect)(()=>{let e=w.map(e=>c.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,n,r)=>{let i=m.current;if(!i)return{suggestions:[]};let a=e.getOffsetAt(t),o=e.getValue(),s=o.slice(Math.max(0,a-T),a),l=o.slice(a,a+E),u=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),d=A(u),f={triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind};if(!j(f,d))return{suggestions:[]};let p=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,_=e.getWordUntilPosition(t),y={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:_.startColumn,endColumn:t.column},b=h(v.getState().wsUrl),x=e=>e.map((e,t)=>({label:e.label,kind:I(e.kind),insertText:e.insertText,detail:e.detail??(e.source?`WrongStack ${e.source}`:void 0),documentation:e.documentation,sortText:e.sortText??`${String(t).padStart(3,`0`)}-${e.label}`,range:y,insertTextRules:e.kind===`snippet`?c.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),S=N({filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,versionId:e.getVersionId(),triggerCharacter:n.triggerCharacter,linePrefix:u,suffix:l}),C=g.current.get(S);return C&&C.expiresAt>Date.now()?{suggestions:x(C.items)}:await new Promise(a=>{let c=!1,u=()=>{},m=null,h,_=e=>{c||(c=!0,u(),h!==void 0&&window.clearTimeout(h),m?.dispose(),a({suggestions:e}))};u=b.on(`completion.result`,e=>{let t=e;t.payload.requestId===p&&(g.current.set(S,{expiresAt:Date.now()+O,items:t.payload.items}),_(x(t.payload.items)))}),h=window.setTimeout(()=>_([]),D),m=r.onCancellationRequested(()=>_([])),b.requestCompletion({requestId:p,filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:o.length<=5e5?o:void 0,prefix:s,suffix:l,triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind,allowLlm:M(f,d)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let H=(0,P.useCallback)(()=>{let e=l.current;if(!e)return null;let t=e.getSelection();if(!t||t.isEmpty())return null;let n=e.getModel();if(!n)return null;let r=n.getValueInRange(t);return r.trim()?{content:r,startLine:t.startLineNumber,endLine:t.endLineNumber}:null},[]),U=(0,P.useCallback)(()=>{b(`chat`),requestAnimationFrame(()=>{document.querySelector(`textarea[placeholder*="agent"], textarea[placeholder*="follow-up"]`)?.focus()})},[]),W=(0,P.useCallback)(()=>{let e=m.current;if(!e)return;let t=H();t&&(_.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),U())},[H,U]),G=(0,P.useCallback)(()=>{let e=m.current;e&&(_.getState().addRef({kind:`file`,path:e}),U())},[U]),K=(0,P.useCallback)(t=>{l.current=t,u.setTheme(x()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();V(!!e&&!e.isEmpty())}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[p.CtrlCmd|p.Shift|d.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?W():G()}})},[W,G]),q=(0,P.useCallback)(e=>{n&&e!==void 0&&i(n,e)},[n,i]);return(0,P.useEffect)(()=>{let e=e=>{let t=e.ctrlKey||e.metaKey,r=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;!t||!r||(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:n}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),n&&S.getState().closeFile(n)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),t.length===0?(0,F.jsx)(`div`,{className:`flex h-full min-w-0 items-center justify-center`,children:(0,F.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`activity:codeEditor.noFilesOpen`)}),(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60`,children:e(`activity:codeEditor.selectToEdit`)})]})}):(0,F.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,F.jsx)(L,{}),(0,F.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(B||C)&&(0,F.jsx)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-lg border border-border bg-popover/95 backdrop-blur shadow-md p-1`,children:(0,F.jsxs)(`button`,{type:`button`,onClick:B?W:G,className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-foreground hover:bg-accent transition-colors`,title:e(B?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[B?(0,F.jsx)(o,{className:`h-3 w-3`}):(0,F.jsx)(r,{className:`h-3 w-3`}),(0,F.jsx)(`span`,{children:e(B?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),C?(0,F.jsx)(f,{language:R,value:C.content,onChange:q,theme:z,onMount:K,loading:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,F.jsx)(`span`,{className:`text-[11px] text-muted-foreground animate-pulse`,children:e(`activity:codeEditor.loadingEditor`)})}),options:{minimap:{enabled:!1},fontSize:13,fontFamily:`'IBM Plex Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace`,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},C.path):(0,F.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]})]})}export{R as CodeEditor};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Un as r,Z as i,ci as a,jt as o,lr as s}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{a as c,c as l,i as u,n as d,o as f,r as p,t as m}from"./monaco-DqY9Mr3N.js";import{t as h}from"./ws-client-BAV7SLzK.js";import{t as g}from"./utils-DBns3uMk.js";import{I as _,L as v,R as y,T as b,b as x,x as S}from"./index-BhO3caLf.js";var C={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},w=Array.from(new Set(Object.values(C))).filter(e=>e!==`plaintext`),T=12e3,E=4e3,D=5e3,O=1e4;function k(e){return C[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function A(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function j(e,t){return e.triggerCharacter?!0:t.length>=3}function M(e,t){return e.triggerCharacter===`.`?!0:e.triggerCharacter?!1:/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function N(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}var P=e(t(),1),F=n();l.config({monaco:m});function I(e){switch(e){case`method`:return c.CompletionItemKind.Method;case`function`:return c.CompletionItemKind.Function;case`constructor`:return c.CompletionItemKind.Constructor;case`field`:return c.CompletionItemKind.Field;case`variable`:return c.CompletionItemKind.Variable;case`class`:return c.CompletionItemKind.Class;case`interface`:return c.CompletionItemKind.Interface;case`module`:return c.CompletionItemKind.Module;case`property`:return c.CompletionItemKind.Property;case`unit`:return c.CompletionItemKind.Unit;case`value`:return c.CompletionItemKind.Value;case`enum`:return c.CompletionItemKind.Enum;case`keyword`:return c.CompletionItemKind.Keyword;case`snippet`:return c.CompletionItemKind.Snippet;case`file`:return c.CompletionItemKind.File;case`reference`:return c.CompletionItemKind.Reference;default:return c.CompletionItemKind.Text}}function L(){let e=_(e=>e.openFiles),t=_(e=>e.activeFilePath),n=_(e=>e.setActiveFile),r=_(e=>e.closeFile);return e.length===0?null:(0,F.jsx)(`div`,{className:`flex items-center border-b bg-muted/40 overflow-x-auto shrink-0`,children:e.map(e=>{let a=e.path===t,o=e.path.split(`/`).pop()??e.path;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),r(e.path))},className:g(`group flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r whitespace-nowrap min-w-0 max-w-[180px] transition-colors`,a?`bg-background border-t-2 border-t-primary text-foreground -mb-px`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),title:e.path,children:[e.dirty&&(0,F.jsx)(s,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,F.jsx)(`span`,{className:`truncate`,children:o}),(0,F.jsx)(i,{className:g(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,a&&`opacity-100`),onClick:t=>{t.stopPropagation(),r(e.path)}})]},e.path)})})}function R(){let{t:e}=a(),t=_(e=>e.openFiles),n=_(e=>e.activeFilePath),i=_(e=>e.updateContent),{theme:s}=S(),l=(0,P.useRef)(null),m=(0,P.useRef)(n),g=(0,P.useRef)(new Map),C=(0,P.useMemo)(()=>t.find(e=>e.path===n)??null,[t,n]),R=n?k(n):`plaintext`,z=x(),[B,V]=(0,P.useState)(!1);(0,P.useEffect)(()=>{m.current=n},[n]),(0,P.useEffect)(()=>{let e=x();u.setTheme(e)},[s]),(0,P.useEffect)(()=>{let e=w.map(e=>c.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,n,r)=>{let i=m.current;if(!i)return{suggestions:[]};let a=e.getOffsetAt(t),o=e.getValue(),s=o.slice(Math.max(0,a-T),a),l=o.slice(a,a+E),u=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),d=A(u),f={triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind};if(!j(f,d))return{suggestions:[]};let p=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,_=e.getWordUntilPosition(t),v={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:_.startColumn,endColumn:t.column},b=h(y.getState().wsUrl),x=e=>e.map((e,t)=>({label:e.label,kind:I(e.kind),insertText:e.insertText,detail:e.detail??(e.source?`WrongStack ${e.source}`:void 0),documentation:e.documentation,sortText:e.sortText??`${String(t).padStart(3,`0`)}-${e.label}`,range:v,insertTextRules:e.kind===`snippet`?c.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),S=N({filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,versionId:e.getVersionId(),triggerCharacter:n.triggerCharacter,linePrefix:u,suffix:l}),C=g.current.get(S);return C&&C.expiresAt>Date.now()?{suggestions:x(C.items)}:await new Promise(a=>{let c=!1,u=()=>{},m=null,h,_=e=>{c||(c=!0,u(),h!==void 0&&window.clearTimeout(h),m?.dispose(),a({suggestions:e}))};u=b.on(`completion.result`,e=>{let t=e;t.payload.requestId===p&&(g.current.set(S,{expiresAt:Date.now()+O,items:t.payload.items}),_(x(t.payload.items)))}),h=window.setTimeout(()=>_([]),D),m=r.onCancellationRequested(()=>_([])),b.requestCompletion({requestId:p,filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:o.length<=5e5?o:void 0,prefix:s,suffix:l,triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind,allowLlm:M(f,d)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let H=(0,P.useCallback)(()=>{let e=l.current;if(!e)return null;let t=e.getSelection();if(!t||t.isEmpty())return null;let n=e.getModel();if(!n)return null;let r=n.getValueInRange(t);return r.trim()?{content:r,startLine:t.startLineNumber,endLine:t.endLineNumber}:null},[]),U=(0,P.useCallback)(()=>{b(`chat`),requestAnimationFrame(()=>{document.querySelector(`textarea[placeholder*="agent"], textarea[placeholder*="follow-up"]`)?.focus()})},[]),W=(0,P.useCallback)(()=>{let e=m.current;if(!e)return;let t=H();t&&(v.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),U())},[H,U]),G=(0,P.useCallback)(()=>{let e=m.current;e&&(v.getState().addRef({kind:`file`,path:e}),U())},[U]),K=(0,P.useCallback)(t=>{l.current=t,u.setTheme(x()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();V(!!e&&!e.isEmpty())}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[p.CtrlCmd|p.Shift|d.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?W():G()}})},[W,G]),q=(0,P.useCallback)(e=>{n&&e!==void 0&&i(n,e)},[n,i]);return(0,P.useEffect)(()=>{let e=e=>{let t=e.ctrlKey||e.metaKey,r=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;!t||!r||(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:n}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),n&&_.getState().closeFile(n)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),t.length===0?(0,F.jsx)(`div`,{className:`flex h-full min-w-0 items-center justify-center`,children:(0,F.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`activity:codeEditor.noFilesOpen`)}),(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60`,children:e(`activity:codeEditor.selectToEdit`)})]})}):(0,F.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,F.jsx)(L,{}),(0,F.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(B||C)&&(0,F.jsx)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-lg border border-border bg-popover/95 backdrop-blur shadow-md p-1`,children:(0,F.jsxs)(`button`,{type:`button`,onClick:B?W:G,className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-foreground hover:bg-accent transition-colors`,title:e(B?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[B?(0,F.jsx)(o,{className:`h-3 w-3`}):(0,F.jsx)(r,{className:`h-3 w-3`}),(0,F.jsx)(`span`,{children:e(B?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),C?(0,F.jsx)(f,{language:R,value:C.content,onChange:q,theme:z,onMount:K,loading:(0,F.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,F.jsx)(`span`,{className:`text-[11px] text-muted-foreground animate-pulse`,children:e(`activity:codeEditor.loadingEditor`)})}),options:{minimap:{enabled:!1},fontSize:13,fontFamily:`'IBM Plex Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace`,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},C.path):(0,F.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,F.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]})]})}export{R as CodeEditor};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{At as r,Bt as i,Mn as a,Wr as o,jr as s,lt as c,ni as l,or as u,qn as d,si as f,ti as p,ui as m}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";var h=e(t(),1),g=n();function _({title:e,value:t,subtitle:n,icon:r,color:i=`text-blue-500`,trend:a}){let{t:o}=f();return(0,g.jsxs)(`div`,{className:`bg-card rounded-lg border p-4 shadow-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1 ${i}`,children:t}),n&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,g.jsx)(`div`,{className:`p-2 rounded-lg bg-muted ${i}`,children:(0,g.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,g.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,g.jsx)(c,{className:`w-3 h-3 text-green-500`}),a===`down`&&(0,g.jsx)(c,{className:`w-3 h-3 text-red-500 rotate-180`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function v(){let{t:e}=f(),[t,n]=(0,h.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[v,x]=(0,h.useState)(!0),[S,C]=(0,h.useState)(2e3),w=(0,h.useCallback)(async()=>{try{let e=await fetch(`/debug/watcher-metrics`),t=null;e.ok&&(t=await e.json());let r={memoryUsage:{heapUsed:performance.memory?.usedJSHeapSize??0,heapTotal:performance.memory?.totalJSHeapSize??0,external:0,rss:0,arrayBuffers:0},uptime:performance.timeOrigin?performance.now()/1e3:0,cpuUsage:{user:0,system:0}};n({fileWatcher:t,system:r,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:m.t(`activity:debug.fetchFailed`)}))}finally{x(!1)}},[]);return(0,h.useEffect)(()=>{w();let e=setInterval(w,S);return()=>clearInterval(e)},[w,S]),(0,g.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto bg-background p-6`,children:(0,g.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h1`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,g.jsx)(l,{className:`w-7 h-7`}),e(`activity:debug.heading`)]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e(`activity:debug.subtitle`)})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(i,{className:`w-4 h-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,g.jsxs)(`select`,{value:S,onChange:e=>C(Number(e.target.value)),className:`bg-background border rounded px-2 py-1 text-sm`,children:[(0,g.jsx)(`option`,{value:1e3,children:`1s`}),(0,g.jsx)(`option`,{value:2e3,children:`2s`}),(0,g.jsx)(`option`,{value:5e3,children:`5s`}),(0,g.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,g.jsxs)(`button`,{onClick:()=>{x(!0),w()},disabled:v,className:`flex items-center gap-2 px-3 py-1.5 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 disabled:opacity-50`,children:[(0,g.jsx)(i,{className:`w-4 h-4 ${v?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]}),t.lastUpdated&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(u,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/30 rounded-lg text-destructive`,children:[(0,g.jsx)(p,{className:`w-5 h-5 flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,g.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(d,{className:`w-5 h-5`}),e(`activity:debug.fileWatcher`)]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:r,color:t.fileWatcher?.watcherActive?`text-green-500`:`text-red-500`}),(0,g.jsx)(_,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:o,color:`text-purple-500`}),(0,g.jsx)(_,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:s,color:`text-blue-500`,trend:`neutral`}),(0,g.jsx)(_,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:a,color:`text-cyan-500`})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:c,color:`text-green-500`}),(0,g.jsx)(_,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:i,color:`text-orange-500`}),(0,g.jsx)(_,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:u,color:`text-yellow-500`}),(0,g.jsx)(_,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:l,color:`text-indigo-500`})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(a,{className:`w-5 h-5`}),e(`activity:debug.browserPerf`)]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.heapUsed`),value:y(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:l,color:`text-blue-500`}),(0,g.jsx)(_,{title:e(`activity:debug.heapTotal`),value:y(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:l,color:`text-green-500`}),(0,g.jsx)(_,{title:e(`activity:debug.pageUptime`),value:b(t.system?.uptime??0),subtitle:e(`activity:debug.sinceLoad`),icon:u,color:`text-purple-500`})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(s,{className:`w-5 h-5`}),e(`activity:debug.rawData`)]}),(0,g.jsx)(`div`,{className:`bg-card rounded-lg border p-4 shadow-sm`,children:(0,g.jsx)(`pre`,{className:`text-xs font-mono overflow-x-auto`,children:JSON.stringify({fileWatcher:t.fileWatcher,browserMemory:t.system?.memoryUsage,pageUptime:t.system?.uptime},null,2)})})]})]})})}function y(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function b(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{v as DebugDashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{At as r,Bt as i,Gr as a,Jn as o,Mr as s,Nn as c,ci as l,di as u,lt as d,ni as f,ri as p,sr as m}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";var h=e(t(),1),g=n();function _({title:e,value:t,subtitle:n,icon:r,color:i=`text-blue-500`,trend:a}){let{t:o}=l();return(0,g.jsxs)(`div`,{className:`bg-card rounded-lg border p-4 shadow-sm`,children:[(0,g.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,g.jsx)(`p`,{className:`text-2xl font-bold mt-1 ${i}`,children:t}),n&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,g.jsx)(`div`,{className:`p-2 rounded-lg bg-muted ${i}`,children:(0,g.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,g.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,g.jsx)(d,{className:`w-3 h-3 text-green-500`}),a===`down`&&(0,g.jsx)(d,{className:`w-3 h-3 text-red-500 rotate-180`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function v(){let{t:e}=l(),[t,n]=(0,h.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[v,x]=(0,h.useState)(!0),[S,C]=(0,h.useState)(2e3),w=(0,h.useCallback)(async()=>{try{let e=await fetch(`/debug/watcher-metrics`),t=null;e.ok&&(t=await e.json());let r={memoryUsage:{heapUsed:performance.memory?.usedJSHeapSize??0,heapTotal:performance.memory?.totalJSHeapSize??0,external:0,rss:0,arrayBuffers:0},uptime:performance.timeOrigin?performance.now()/1e3:0,cpuUsage:{user:0,system:0}};n({fileWatcher:t,system:r,lastUpdated:new Date,error:null})}catch(e){n(t=>({...t,error:e instanceof Error?e.message:u.t(`activity:debug.fetchFailed`)}))}finally{x(!1)}},[]);return(0,h.useEffect)(()=>{w();let e=setInterval(w,S);return()=>clearInterval(e)},[w,S]),(0,g.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto bg-background p-6`,children:(0,g.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`h1`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,g.jsx)(p,{className:`w-7 h-7`}),e(`activity:debug.heading`)]}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:e(`activity:debug.subtitle`)})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,g.jsx)(i,{className:`w-4 h-4 text-muted-foreground`}),(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,g.jsxs)(`select`,{value:S,onChange:e=>C(Number(e.target.value)),className:`bg-background border rounded px-2 py-1 text-sm`,children:[(0,g.jsx)(`option`,{value:1e3,children:`1s`}),(0,g.jsx)(`option`,{value:2e3,children:`2s`}),(0,g.jsx)(`option`,{value:5e3,children:`5s`}),(0,g.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,g.jsxs)(`button`,{onClick:()=>{x(!0),w()},disabled:v,className:`flex items-center gap-2 px-3 py-1.5 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 disabled:opacity-50`,children:[(0,g.jsx)(i,{className:`w-4 h-4 ${v?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]}),t.lastUpdated&&(0,g.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,g.jsx)(m,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:t.lastUpdated.toLocaleTimeString()})]}),t.error&&(0,g.jsxs)(`div`,{className:`flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/30 rounded-lg text-destructive`,children:[(0,g.jsx)(f,{className:`w-5 h-5 flex-shrink-0`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,g.jsx)(`p`,{className:`text-sm opacity-80`,children:t.error})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(o,{className:`w-5 h-5`}),e(`activity:debug.fileWatcher`)]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.watcherStatus`),value:t.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:r,color:t.fileWatcher?.watcherActive?`text-green-500`:`text-red-500`}),(0,g.jsx)(_,{title:e(`activity:debug.activeProjects`),value:t.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:a,color:`text-purple-500`}),(0,g.jsx)(_,{title:e(`activity:debug.fileChanges`),value:t.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:s,color:`text-blue-500`,trend:`neutral`}),(0,g.jsx)(_,{title:e(`activity:debug.filesProcessed`),value:t.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:c,color:`text-cyan-500`})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.broadcastsSent`),value:t.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:d,color:`text-green-500`}),(0,g.jsx)(_,{title:e(`activity:debug.debounceResets`),value:t.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:i,color:`text-orange-500`}),(0,g.jsx)(_,{title:e(`activity:debug.avgDebounce`),value:`${(t.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:m,color:`text-yellow-500`}),(0,g.jsx)(_,{title:e(`activity:debug.totalDelay`),value:`${(t.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:p,color:`text-indigo-500`})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(c,{className:`w-5 h-5`}),e(`activity:debug.browserPerf`)]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,g.jsx)(_,{title:e(`activity:debug.heapUsed`),value:y(t.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:p,color:`text-blue-500`}),(0,g.jsx)(_,{title:e(`activity:debug.heapTotal`),value:y(t.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:p,color:`text-green-500`}),(0,g.jsx)(_,{title:e(`activity:debug.pageUptime`),value:b(t.system?.uptime??0),subtitle:e(`activity:debug.sinceLoad`),icon:m,color:`text-purple-500`})]})]}),(0,g.jsxs)(`section`,{children:[(0,g.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2 mb-4`,children:[(0,g.jsx)(s,{className:`w-5 h-5`}),e(`activity:debug.rawData`)]}),(0,g.jsx)(`div`,{className:`bg-card rounded-lg border p-4 shadow-sm`,children:(0,g.jsx)(`pre`,{className:`text-xs font-mono overflow-x-auto`,children:JSON.stringify({fileWatcher:t.fileWatcher,browserMemory:t.system?.memoryUsage,pageUptime:t.system?.uptime},null,2)})})]})]})})}function y(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function b(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{v as DebugDashboard};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Tt as r,Yt as i,Z as a,Zn as o,gr as s,si as c,ui as l}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{t as u}from"./utils-sFCTikqz.js";import{C as d,T as f}from"./index-BSuiEQIC.js";var p=e(t(),1);function m(e,t,n){return e<t?t:e>n?n:e}function h(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[m(r,0,1),Math.max(0,i),a]:null}function g(e){return m(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function _(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function v(e){let t=h(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,v=-1.2684380046*d+2.6097574011*f-.3413193965*p,y=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${_(g(m))}${_(g(v))}${_(g(y))}`}function y(e){let t=e.trim(),n=v(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var b=n(),x=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],S=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function C(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function w({t:e,label:t}){let n=e.bg??`#fff`,r=e.surface??n,i=e.fg??`#111`,a=e.muted??i,o=e.primary??`#3b82f6`,s=e.accent??o,c=e.border??a,l=e.radius??`0.5rem`,u=e.fontSans??`system-ui, sans-serif`,d=e.fontDisplay??u,f=e.shadow&&e.shadow!==`none`?e.shadow:void 0;return(0,b.jsxs)(`div`,{style:{background:n,color:i,fontFamily:u},className:`p-3 flex flex-col gap-2 overflow-hidden`,children:[(0,b.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:a},children:t}),(0,b.jsxs)(`div`,{style:{background:r,border:`1px solid ${c}`,borderRadius:l,boxShadow:f},className:`p-3 flex flex-col gap-2`,children:[(0,b.jsx)(`div`,{style:{fontFamily:d},className:`text-base font-bold leading-tight`,children:`Aa Heading`}),(0,b.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:a},children:`The quick brown fox jumps over the lazy dog.`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,b.jsx)(`span`,{style:{background:o,color:n,borderRadius:l},className:`text-[10px] font-semibold px-2.5 py-1`,children:`Primary`}),(0,b.jsx)(`span`,{style:{border:`1px solid ${c}`,color:i,borderRadius:l},className:`text-[10px] px-2 py-1`,children:`Ghost`}),(0,b.jsx)(`span`,{style:{background:s,color:n,borderRadius:`999px`},className:`text-[9px] font-semibold px-2 py-0.5 ml-auto`,children:`Badge`})]}),(0,b.jsx)(`div`,{style:{border:`1px solid ${c}`,borderRadius:l,color:a},className:`text-[10px] px-2 py-1.5 mt-1`,children:`Input field…`})]})]})}function T({kit:e,overrides:t,onSet:n}){let[r,i]=(0,p.useState)(`light`),{t:a}=c(),o=C(r===`light`?e.light:e.dark,t,r);return(0,b.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,b.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:u(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:S.filter(e=>o[e]).map(e=>{let t=y(o[e]??``)??`#000000`;return(0,b.jsxs)(`label`,{className:`flex flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,b.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,b.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function E({className:e}){let{client:t}=d(),{t:n}=c(),[m,h]=(0,p.useState)([]),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)({}),[S,E]=(0,p.useState)(`web`),[D,O]=(0,p.useState)(``),[k,A]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.payload;h(t?.kits??[]),_(t?.activeKit??null),y(t?.overrides??{})},n=e=>{let t=e.payload;t?.ok&&t.kit&&(_(t.kit),y(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&y(t.overrides)},i=e=>{let t=e.payload;A(t?.ok?l.t(`activity:design.wrote`,{path:t.path}):l.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},a=e=>{let t=e.payload;if(!t?.ok){A(l.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);A(t.violationCount?l.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):l.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return t.on(`design.list`,e),t.on(`design.use`,n),t.on(`design.set`,r),t.on(`design.materialize`,i),t.on(`design.verify`,a),t.send({type:`design.list`}),()=>{t.off(`design.list`,e),t.off(`design.use`,n),t.off(`design.set`,r),t.off(`design.materialize`,i),t.off(`design.verify`,a)}},[t]);let j=(0,p.useCallback)(e=>t?.send({type:`design.use`,payload:{kit:e,stack:S}}),[t,S]),M=(0,p.useCallback)((e,n)=>{y(t=>({...t,[e]:n})),t?.send({type:`design.set`,payload:{overrides:{[e]:n}}})},[t]),N=(0,p.useCallback)(()=>{A(l.t(`activity:design.writing`)),t?.send({type:`design.materialize`,payload:{stack:S}})},[t,S]),P=(0,p.useCallback)(()=>{A(l.t(`activity:design.scanning`)),t?.send({type:`design.verify`})},[t]),F=(0,p.useMemo)(()=>{let e=D.trim().toLowerCase();return[...e?m.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):m].sort((e,t)=>e.name.localeCompare(t.name))},[m,D]);return(0,b.jsxs)(`div`,{className:u(`flex h-full min-h-0 min-w-0 flex-col`,e),children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-4 py-3 border-b border-border/60`,children:[(0,b.jsx)(i,{className:`w-5 h-5 text-muted-foreground`}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`activity:design.heading`)}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:design.kitsCount`,{count:F.length})}),(0,b.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:n(`activity:design.searchPlaceholder`),className:`ml-2 text-xs bg-transparent border border-border/60 rounded px-2 py-1 w-44`}),(0,b.jsx)(`select`,{value:S,onChange:e=>E(e.target.value),className:`text-xs bg-transparent border border-border/60 rounded px-1.5 py-1`,title:n(`activity:design.stackTitle`),children:x.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),k&&(0,b.jsx)(`span`,{className:`text-[11px] text-muted-foreground max-w-48 truncate`,children:k}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>f(`chat`),className:`ml-auto p-1 rounded hover:bg-muted text-muted-foreground`,title:n(`common:action.close`),children:(0,b.jsx)(a,{className:`w-4 h-4`})})]}),(0,b.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4`,children:(0,b.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]`,children:F.map(e=>{let t=g===e.id,i=t?v:{};return(0,b.jsxs)(`div`,{className:u(`rounded-xl border overflow-hidden flex flex-col`,t?`border-primary/60 ring-1 ring-primary/40`:`border-border/60`),children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2`,children:[(0,b.jsx)(w,{t:C(e.light,i,`light`),label:n(`activity:designStudio.light`)}),(0,b.jsx)(w,{t:C(e.dark,i,`dark`),label:n(`activity:designStudio.dark`)})]}),(0,b.jsxs)(`div`,{className:`p-3 border-t border-border/60 flex flex-col gap-1.5 bg-card`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,b.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,b.jsx)(s,{className:`w-3 h-3`}),` `,n(`activity:design.active`)]})]}),(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>j(e.id),className:u(`text-[11px] px-2.5 py-1 rounded font-medium`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:n(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,b.jsxs)(`button`,{type:`button`,onClick:N,className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded font-medium border border-border/60 hover:bg-muted`,title:n(`activity:design.materializeTitle`,{stack:S}),children:[(0,b.jsx)(o,{className:`w-3 h-3`}),` `,n(`activity:design.materialize`)]}),t&&(0,b.jsxs)(`button`,{type:`button`,onClick:P,className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded font-medium border border-border/60 hover:bg-muted`,title:n(`activity:design.verifyTitle`),children:[(0,b.jsx)(r,{className:`w-3 h-3`}),` `,n(`activity:design.verify`)]}),(0,b.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.bestFor})]}),t&&(0,b.jsx)(T,{kit:e,overrides:i,onSet:M})]})]},e.id)})})})]})}export{E as DesignGalleryView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Qn as r,Tt as i,Yt as a,Z as o,_r as s,ci as c,di as l}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as u}from"./utils-DBns3uMk.js";import{C as d,T as f}from"./index-BhO3caLf.js";var p=e(t(),1);function m(e,t,n){return e<t?t:e>n?n:e}function h(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[m(r,0,1),Math.max(0,i),a]:null}function g(e){return m(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function _(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function v(e){let t=h(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,v=-1.2684380046*d+2.6097574011*f-.3413193965*p,y=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${_(g(m))}${_(g(v))}${_(g(y))}`}function y(e){let t=e.trim(),n=v(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var b=n(),x=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],S=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function C(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function w({t:e,label:t}){let n=e.bg??`#fff`,r=e.surface??n,i=e.fg??`#111`,a=e.muted??i,o=e.primary??`#3b82f6`,s=e.accent??o,c=e.border??a,l=e.radius??`0.5rem`,u=e.fontSans??`system-ui, sans-serif`,d=e.fontDisplay??u,f=e.shadow&&e.shadow!==`none`?e.shadow:void 0;return(0,b.jsxs)(`div`,{style:{background:n,color:i,fontFamily:u},className:`p-3 flex flex-col gap-2 overflow-hidden`,children:[(0,b.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:a},children:t}),(0,b.jsxs)(`div`,{style:{background:r,border:`1px solid ${c}`,borderRadius:l,boxShadow:f},className:`p-3 flex flex-col gap-2`,children:[(0,b.jsx)(`div`,{style:{fontFamily:d},className:`text-base font-bold leading-tight`,children:`Aa Heading`}),(0,b.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:a},children:`The quick brown fox jumps over the lazy dog.`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1`,children:[(0,b.jsx)(`span`,{style:{background:o,color:n,borderRadius:l},className:`text-[10px] font-semibold px-2.5 py-1`,children:`Primary`}),(0,b.jsx)(`span`,{style:{border:`1px solid ${c}`,color:i,borderRadius:l},className:`text-[10px] px-2 py-1`,children:`Ghost`}),(0,b.jsx)(`span`,{style:{background:s,color:n,borderRadius:`999px`},className:`text-[9px] font-semibold px-2 py-0.5 ml-auto`,children:`Badge`})]}),(0,b.jsx)(`div`,{style:{border:`1px solid ${c}`,borderRadius:l,color:a},className:`text-[10px] px-2 py-1.5 mt-1`,children:`Input field…`})]})]})}function T({kit:e,overrides:t,onSet:n}){let[r,i]=(0,p.useState)(`light`),{t:a}=c(),o=C(r===`light`?e.light:e.dark,t,r);return(0,b.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,b.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:a(`activity:design.colors`)}),(0,b.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,b.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:u(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:S.filter(e=>o[e]).map(e=>{let t=y(o[e]??``)??`#000000`;return(0,b.jsxs)(`label`,{className:`flex flex-col items-center gap-0.5`,title:`${e}: ${o[e]}`,children:[(0,b.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,b.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function E({className:e}){let{client:t}=d(),{t:n}=c(),[m,h]=(0,p.useState)([]),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)({}),[S,E]=(0,p.useState)(`web`),[D,O]=(0,p.useState)(``),[k,A]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.payload;h(t?.kits??[]),_(t?.activeKit??null),y(t?.overrides??{})},n=e=>{let t=e.payload;t?.ok&&t.kit&&(_(t.kit),y(t.overrides??{}))},r=e=>{let t=e.payload;t?.ok&&t.overrides&&y(t.overrides)},i=e=>{let t=e.payload;A(t?.ok?l.t(`activity:design.wrote`,{path:t.path}):l.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},a=e=>{let t=e.payload;if(!t?.ok){A(l.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);A(t.violationCount?l.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):l.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return t.on(`design.list`,e),t.on(`design.use`,n),t.on(`design.set`,r),t.on(`design.materialize`,i),t.on(`design.verify`,a),t.send({type:`design.list`}),()=>{t.off(`design.list`,e),t.off(`design.use`,n),t.off(`design.set`,r),t.off(`design.materialize`,i),t.off(`design.verify`,a)}},[t]);let j=(0,p.useCallback)(e=>t?.send({type:`design.use`,payload:{kit:e,stack:S}}),[t,S]),M=(0,p.useCallback)((e,n)=>{y(t=>({...t,[e]:n})),t?.send({type:`design.set`,payload:{overrides:{[e]:n}}})},[t]),N=(0,p.useCallback)(()=>{A(l.t(`activity:design.writing`)),t?.send({type:`design.materialize`,payload:{stack:S}})},[t,S]),P=(0,p.useCallback)(()=>{A(l.t(`activity:design.scanning`)),t?.send({type:`design.verify`})},[t]),F=(0,p.useMemo)(()=>{let e=D.trim().toLowerCase();return[...e?m.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):m].sort((e,t)=>e.name.localeCompare(t.name))},[m,D]);return(0,b.jsxs)(`div`,{className:u(`flex h-full min-h-0 min-w-0 flex-col`,e),children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-4 py-3 border-b border-border/60`,children:[(0,b.jsx)(a,{className:`w-5 h-5 text-muted-foreground`}),(0,b.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`activity:design.heading`)}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`activity:design.kitsCount`,{count:F.length})}),(0,b.jsx)(`input`,{value:D,onChange:e=>O(e.target.value),placeholder:n(`activity:design.searchPlaceholder`),className:`ml-2 text-xs bg-transparent border border-border/60 rounded px-2 py-1 w-44`}),(0,b.jsx)(`select`,{value:S,onChange:e=>E(e.target.value),className:`text-xs bg-transparent border border-border/60 rounded px-1.5 py-1`,title:n(`activity:design.stackTitle`),children:x.map(e=>(0,b.jsx)(`option`,{value:e,children:e},e))}),k&&(0,b.jsx)(`span`,{className:`text-[11px] text-muted-foreground max-w-48 truncate`,children:k}),(0,b.jsx)(`button`,{type:`button`,onClick:()=>f(`chat`),className:`ml-auto p-1 rounded hover:bg-muted text-muted-foreground`,title:n(`common:action.close`),children:(0,b.jsx)(o,{className:`w-4 h-4`})})]}),(0,b.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto p-4`,children:(0,b.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]`,children:F.map(e=>{let t=g===e.id,a=t?v:{};return(0,b.jsxs)(`div`,{className:u(`rounded-xl border overflow-hidden flex flex-col`,t?`border-primary/60 ring-1 ring-primary/40`:`border-border/60`),children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2`,children:[(0,b.jsx)(w,{t:C(e.light,a,`light`),label:n(`activity:designStudio.light`)}),(0,b.jsx)(w,{t:C(e.dark,a,`dark`),label:n(`activity:designStudio.dark`)})]}),(0,b.jsxs)(`div`,{className:`p-3 border-t border-border/60 flex flex-col gap-1.5 bg-card`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,b.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,b.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,b.jsx)(s,{className:`w-3 h-3`}),` `,n(`activity:design.active`)]})]}),(0,b.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>j(e.id),className:u(`text-[11px] px-2.5 py-1 rounded font-medium`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:n(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,b.jsxs)(`button`,{type:`button`,onClick:N,className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded font-medium border border-border/60 hover:bg-muted`,title:n(`activity:design.materializeTitle`,{stack:S}),children:[(0,b.jsx)(r,{className:`w-3 h-3`}),` `,n(`activity:design.materialize`)]}),t&&(0,b.jsxs)(`button`,{type:`button`,onClick:P,className:`inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded font-medium border border-border/60 hover:bg-muted`,title:n(`activity:design.verifyTitle`),children:[(0,b.jsx)(i,{className:`w-3 h-3`}),` `,n(`activity:design.verify`)]}),(0,b.jsx)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:e.bestFor})]}),t&&(0,b.jsx)(T,{kit:e,overrides:a,onSet:M})]})]},e.id)})})})]})}export{E as DesignGalleryView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{Bt as r,Ht as i,Or as a,Qt as o,Xr as s,Z as c,_r as l,ar as u,at as d,dt as f,jt as p}from"./vendor-Ch4m_qLI.js";import{t as m}from"./ws-client-BAV7SLzK.js";import{t as h}from"./utils-DBns3uMk.js";import{N as g,R as _}from"./index-BhO3caLf.js";var v=e(t(),1),y=n();function b({onClose:e}){let t=_(e=>e.wsUrl),{boards:n,activeBoardId:o,activeBoard:l,loading:d,error:p,setLoading:b,setActiveBoardId:C}=g(),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(null),P=(0,v.useMemo)(()=>m(t),[t]),F=l?.tasks.find(e=>e.id===A)??null,I=(e,t={})=>{b(!0),P.send({type:e,payload:t})},L=()=>I(`kanban.list`),R=(e=o)=>{e&&I(`kanban.get`,{boardId:e})};(0,v.useEffect)(()=>{L()},[]),(0,v.useEffect)(()=>{!o&&n[0]?.id&&(C(n[0].id),I(`kanban.get`,{boardId:n[0].id}))},[n,o,C]),(0,v.useEffect)(()=>{l&&A&&!l.tasks.some(e=>e.id===A)&&j(null)},[l,A]);let z=()=>{let e=w.trim();e&&(T(``),I(`kanban.create`,{title:e}))},B=()=>{if(!l)return;let e=E.trim();e&&(D(``),I(`kanban.task.add`,{boardId:l.id,title:e,columnId:l.columns[0]?.id??`backlog`}),window.setTimeout(()=>R(l.id),150))},V=()=>{if(!l)return;let e=O.trim();e&&(k(``),I(`kanban.column.add`,{boardId:l.id,title:e}),window.setTimeout(()=>R(l.id),150))},H=()=>{l&&(I(`kanban.delete`,{boardId:l.id}),window.setTimeout(L,150))},U=()=>{l&&(I(`kanban.duplicate`,{boardId:l.id,title:`${l.title} Copy`}),window.setTimeout(L,150))},W=e=>{l&&(I(`kanban.task.remove`,{boardId:l.id,taskId:e.id}),window.setTimeout(()=>R(l.id),150))},G=(e,t)=>{l&&(I(`kanban.task.move`,{boardId:l.id,taskId:e,columnId:t}),window.setTimeout(()=>R(l.id),150))};return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background text-foreground`,children:[(0,y.jsxs)(`aside`,{className:`flex w-[280px] shrink-0 flex-col border-r bg-card/40`,children:[(0,y.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,y.jsx)(`button`,{type:`button`,title:`Back`,onClick:e,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,y.jsx)(a,{size:16})}),(0,y.jsx)(s,{size:17,className:`text-primary`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Kanban`}),(0,y.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[n.length,` boards`]})]}),(0,y.jsx)(`button`,{type:`button`,title:`Refresh`,onClick:L,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,y.jsx)(r,{size:15,className:d?`animate-spin`:void 0})})]}),(0,y.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,y.jsx)(`input`,{value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&z()},placeholder:`New board`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,y.jsx)(`button`,{type:`button`,title:`Create board`,onClick:z,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,y.jsx)(i,{size:16})})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:n.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{C(e.id),I(`kanban.get`,{boardId:e.id})},className:h(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,o===e.id?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,y.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,y.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,y.jsxs)(`span`,{children:[e.taskCount,` tasks`]}),(0,y.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id))})]}),(0,y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,y.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2 border-b px-4`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:l?.title??`No board selected`}),(0,y.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:l?`${l.columns.length} columns / ${l.tasks.length} tasks`:`Create or select a board`})]}),l&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&B()},placeholder:`New task`,className:`h-8 w-56 rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`}),(0,y.jsx)(`button`,{type:`button`,title:`Add task`,onClick:B,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,y.jsx)(i,{size:16})}),(0,y.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&V()},placeholder:`New column`,className:`h-8 w-44 rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`}),(0,y.jsx)(`button`,{type:`button`,title:`Add column`,onClick:V,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,y.jsx)(s,{size:16})}),(0,y.jsx)(`button`,{type:`button`,title:`Duplicate board`,onClick:U,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,y.jsx)(u,{size:16})}),(0,y.jsx)(`button`,{type:`button`,title:`Delete board`,onClick:H,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,y.jsx)(f,{size:16})})]})]}),p&&(0,y.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 text-sm text-destructive`,children:[(0,y.jsx)(c,{size:15}),(0,y.jsx)(`span`,{className:`truncate`,children:p})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden`,children:l?(0,y.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...l.columns].sort((e,t)=>e.order-t.order).map(e=>(0,y.jsx)(x,{board:l,column:e,selectedTaskId:A,dragTaskId:M,setDragTaskId:N,onSelectTask:j,onDeleteTask:W,onMoveTask:G},e.id))}):(0,y.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No kanban board selected.`})})]}),(0,y.jsx)(S,{boards:n,board:l,task:F,onClose:()=>j(null),sendKanban:I,refreshBoard:R})]})}function x({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let c=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,y.jsxs)(`section`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),r&&s(r,t.id),i(null)},className:`flex h-full w-[310px] shrink-0 flex-col rounded-md border bg-muted/25`,children:[(0,y.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,y.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,y.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:c.length})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2`,children:c.map(e=>(0,y.jsxs)(`article`,{draggable:!0,onDragStart:()=>i(e.id),onDragEnd:()=>i(null),onClick:()=>a(e.id),className:h(`cursor-pointer rounded-md border bg-background p-3 shadow-sm transition-colors`,n===e.id?`border-primary`:`hover:border-primary/50`),children:[(0,y.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:e.title}),e.description&&(0,y.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:e.description})]}),(0,y.jsx)(`button`,{type:`button`,title:`Delete task`,onClick:t=>{t.stopPropagation(),o(e)},className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,y.jsx)(f,{size:14})})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,y.jsx)(`span`,{className:E(e.priority),children:e.priority}),(0,y.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:e.status}),e.assignedAgent&&(0,y.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:e.assignedAgent}),e.assignment?.model&&(0,y.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:e.assignment.model})]})]},e.id))})]})}function S({boards:e,board:t,task:n,onClose:r,sendKanban:i,refreshBoard:a}){let[s,f]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[b,x]=(0,v.useState)(``),[S,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(``),[N,P]=(0,v.useState)(``),[F,I]=(0,v.useState)(``);(0,v.useEffect)(()=>{f(n?.assignment?.agentId??n?.assignedAgent??``),h(n?.assignment?.name??``),_(n?.assignment?.role??``),x(n?.assignment?.provider??``),E(n?.assignment?.model??``),O(n?.assignment?.fallbackProfile??``),A(n?.assignment?.fallbackModels?.join(`, `)??``),M(n?.assignment?.tools?.join(`, `)??``),P(n?.assignment?.allowedCapabilities?.join(`, `)??``),I(e.find(e=>e.id!==t?.id)?.id??``)},[t?.id,e,n]);let L=()=>({boardId:t?.id,taskId:n?.id,...s.trim()?{agentId:s.trim()}:{},...m.trim()?{name:m.trim()}:{},...g.trim()?{role:g.trim()}:{},...b.trim()?{provider:b.trim()}:{},...S.trim()?{model:S.trim()}:{},...D.trim()?{fallbackProfile:D.trim()}:{},...k.trim()?{fallbackModels:T(k)}:{},...j.trim()?{tools:T(j)}:{},...N.trim()?{allowedCapabilities:T(N)}:{}});return(0,y.jsxs)(`aside`,{className:`flex w-[340px] shrink-0 flex-col border-l bg-card/40`,children:[(0,y.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n?`Task`:`Selection`}),(0,y.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:n?.id.slice(0,8)??`No task selected`})]}),(0,y.jsx)(`button`,{type:`button`,title:`Close`,onClick:r,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,y.jsx)(c,{size:16})})]}),n?(0,y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,y.jsx)(`div`,{className:`text-sm font-semibold leading-5`,children:n.title}),n.description&&(0,y.jsx)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:n.description}),(0,y.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,y.jsx)(C,{label:`Status`,value:n.status}),(0,y.jsx)(C,{label:`Priority`,value:n.priority}),(0,y.jsx)(C,{label:`Run`,value:n.assignment?.status??`unassigned`}),(0,y.jsx)(C,{label:`Column`,value:n.columnId})]}),(0,y.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,y.jsx)(w,{label:`Agent`,value:s,onChange:f}),(0,y.jsx)(w,{label:`Name`,value:m,onChange:h}),(0,y.jsx)(w,{label:`Role`,value:g,onChange:_}),(0,y.jsx)(w,{label:`Provider`,value:b,onChange:x}),(0,y.jsx)(w,{label:`Model`,value:S,onChange:E}),(0,y.jsx)(w,{label:`Fallback profile`,value:D,onChange:O}),(0,y.jsx)(w,{label:`Fallback models`,value:k,onChange:A}),(0,y.jsx)(w,{label:`Tools`,value:j,onChange:M}),(0,y.jsx)(w,{label:`Capabilities`,value:N,onChange:P})]}),(0,y.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(i(`kanban.task.assign`,L()),window.setTimeout(()=>a(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,y.jsx)(d,{size:15}),`Assign`]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(i(`kanban.task.dispatch`,L()),window.setTimeout(()=>a(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,y.jsx)(p,{size:15}),`Dispatch`]})]}),e.length>1?(0,y.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,y.jsxs)(`label`,{className:`block`,children:[(0,y.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Target board`}),(0,y.jsx)(`select`,{value:F,onChange:e=>I(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:e.filter(e=>e.id!==t?.id).map(e=>(0,y.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!F||i(`kanban.task.copy`,{boardId:t.id,taskId:n.id,targetBoardId:F})},disabled:!F,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,y.jsx)(u,{size:15}),`Copy`]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!F||i(`kanban.task.transfer`,{boardId:t.id,taskId:n.id,targetBoardId:F})},disabled:!F,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,y.jsx)(o,{size:15}),`Transfer`]})]})]}):null,n.successCriteria?.length?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Checks`}),(0,y.jsx)(`div`,{className:`space-y-1.5`,children:n.successCriteria.map(e=>(0,y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs`,children:[(0,y.jsx)(l,{size:13,className:e.status===`passed`?`text-green-600`:`text-muted-foreground`}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.description}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.status})]},e.id))})]}):null]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:`Select a task to edit assignment and dispatch settings.`})]})}function C({label:e,value:t}){return(0,y.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,y.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,y.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function w({label:e,value:t,onChange:n}){return(0,y.jsxs)(`label`,{className:`block`,children:[(0,y.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,y.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`})]})}function T(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function E(e){let t=`rounded px-1.5 py-0.5`;return e===`critical`?`${t} bg-destructive/10 text-destructive`:e===`high`?`${t} bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`low`?`${t} bg-muted text-muted-foreground`:`${t} bg-blue-500/10 text-blue-700 dark:text-blue-300`}export{b as KanbanView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{c as t,m as n,p as r}from"./markdown-D0X23O-i.js";import{$r as i,Dr as a,Ft as o,Hn as s,Z as c,cr as l,ei as u,ht as d,it as f,jt as p,or as m,rn as h,si as g,sn as _,ui as v,xr as y,zt as b}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{n as x}from"./ui-store-D3gGpJWY.js";import{t as S}from"./utils-sFCTikqz.js";import{T as C,d as w}from"./index-BSuiEQIC.js";var T=e(n(),1),E=r(),D={note:s,ask:i,assign:p,steer:o,btw:y,broadcast:p,status:l,result:u},O={high:`text-red-600 bg-red-50 dark:bg-red-950/30`,normal:`text-muted-foreground bg-muted`,low:`text-slate-500 bg-slate-50 dark:bg-slate-950/20`};function k(e){return new Date(e).toLocaleString()}function A(e){let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?v.t(`common:time.justNow`):n<36e5?v.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?v.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?v.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function j(){let{t:e}=g();return(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-muted-foreground gap-3`,children:[(0,E.jsx)(_,{className:`h-12 w-12 opacity-20`}),(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:e(`activity:mailbox.emptyDetail`)}),(0,E.jsx)(`div`,{className:`text-xs max-w-[260px] text-center opacity-60`,children:e(`activity:mailbox.emptyDetailHint`)})]})}function M({readBy:e}){let{t}=g(),n=Object.entries(e);return n.length===0?null:(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-green-50 text-green-700 dark:bg-green-950/30 dark:text-green-400`,title:k(t),children:[(0,E.jsx)(u,{className:`h-2.5 w-2.5`}),e]},e))})]})}function N({className:e}){let{t:n}=g(),r=x(e=>e.selectedMailMessage),i=x(e=>e.setSelectedMailMessage);(0,T.useEffect)(()=>()=>{i(null)},[i]);function o(){i(null),C(`chat`)}if(!r)return(0,E.jsx)(j,{});let s=D[r.type]??h,l=n(`activity:mailbox.type.${r.type}`,{defaultValue:r.type}),p=O[r.priority]??O.normal;return(0,E.jsxs)(`div`,{className:S(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,e),children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b border-border bg-card/40 shrink-0`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:o,className:`flex items-center justify-center w-7 h-7 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:n(`activity:mailbox.backToChat`),children:(0,E.jsx)(a,{className:`h-4 w-4`})}),(0,E.jsx)(`div`,{className:S(`p-1.5 rounded-md shrink-0`,r.completed?`bg-green-100 dark:bg-green-950/40`:`bg-amber-100 dark:bg-amber-950/40`),children:(0,E.jsx)(s,{className:S(`h-4 w-4`,r.completed?`text-green-600 dark:text-green-400`:`text-amber-600 dark:text-amber-400`)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:r.subject}),r.completed&&(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] font-medium text-green-600 dark:text-green-400 shrink-0`,children:[(0,E.jsx)(u,{className:`h-3 w-3`}),n(`activity:mailbox.completed`)]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mt-0.5`,children:[(0,E.jsx)(`span`,{className:`font-medium text-foreground/80`,children:r.from}),(0,E.jsx)(`span`,{children:`→`}),(0,E.jsx)(`span`,{children:r.to===`*`||r.to===`all`?n(`activity:mailbox.everyone`):r.to}),(0,E.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,E.jsx)(m,{className:`h-3 w-3`}),A(r.timestamp)]})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:o,className:`flex items-center justify-center w-7 h-7 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:n(`activity:mailbox.closeTitle`),children:(0,E.jsx)(c,{className:`h-4 w-4`})})]}),(0,E.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:(0,E.jsx)(`div`,{className:`px-4 py-4`,children:(0,E.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,E.jsx)(t,{components:w,children:r.body})})})}),(0,E.jsxs)(`div`,{className:`border-t border-border bg-card/30 px-4 py-3 shrink-0`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(d,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{children:l})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,E.jsx)(`span`,{className:S(`px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase`,p),children:r.priority||`normal`})}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(f,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,title:r.from,children:r.from})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(m,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{children:k(r.timestamp)})]}),r.replyTo&&(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,E.jsx)(b,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(`activity:mailbox.replyTo`,{id:r.replyTo})})]}),r.completed&&r.completedBy&&(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,E.jsx)(u,{className:`h-3 w-3 shrink-0 text-green-500`}),(0,E.jsx)(`span`,{children:r.completedAt?n(`activity:mailbox.completedByAt`,{name:r.completedBy,time:k(r.completedAt)}):n(`activity:mailbox.completedBy`,{name:r.completedBy})})]}),r.outcome&&(0,E.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.outcome`)}),(0,E.jsx)(`span`,{children:r.outcome})]}),r.taskContext&&(0,E.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.task`)}),(0,E.jsx)(`span`,{children:r.taskContext})]})]}),Object.keys(r.readBy??{}).length>0&&(0,E.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,E.jsx)(M,{readBy:r.readBy})})]})]})}export{N as MailboxDetailView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{c as t,m as n,p as r}from"./markdown-D0X23O-i.js";import{Ft as i,Or as a,Sr as o,Un as s,Z as c,ci as l,cn as u,di as d,ei as f,ht as p,in as m,it as h,jt as g,lr as _,sr as v,ti as y,zt as b}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{n as x}from"./ui-store-BdOsq6T-.js";import{t as S}from"./utils-DBns3uMk.js";import{T as C,d as w}from"./index-BhO3caLf.js";var T=e(n(),1),E=r(),D={note:s,ask:f,assign:g,steer:i,btw:o,broadcast:g,status:_,result:y},O={high:`text-red-600 bg-red-50 dark:bg-red-950/30`,normal:`text-muted-foreground bg-muted`,low:`text-slate-500 bg-slate-50 dark:bg-slate-950/20`};function k(e){return new Date(e).toLocaleString()}function A(e){let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?d.t(`common:time.justNow`):n<36e5?d.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?d.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?d.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function j(){let{t:e}=l();return(0,E.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center text-muted-foreground gap-3`,children:[(0,E.jsx)(u,{className:`h-12 w-12 opacity-20`}),(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:e(`activity:mailbox.emptyDetail`)}),(0,E.jsx)(`div`,{className:`text-xs max-w-[260px] text-center opacity-60`,children:e(`activity:mailbox.emptyDetailHint`)})]})}function M({readBy:e}){let{t}=l(),n=Object.entries(e);return n.length===0?null:(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-green-50 text-green-700 dark:bg-green-950/30 dark:text-green-400`,title:k(t),children:[(0,E.jsx)(y,{className:`h-2.5 w-2.5`}),e]},e))})]})}function N({className:e}){let{t:n}=l(),r=x(e=>e.selectedMailMessage),i=x(e=>e.setSelectedMailMessage);(0,T.useEffect)(()=>()=>{i(null)},[i]);function o(){i(null),C(`chat`)}if(!r)return(0,E.jsx)(j,{});let s=D[r.type]??m,u=n(`activity:mailbox.type.${r.type}`,{defaultValue:r.type}),d=O[r.priority]??O.normal;return(0,E.jsxs)(`div`,{className:S(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,e),children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-2.5 border-b border-border bg-card/40 shrink-0`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:o,className:`flex items-center justify-center w-7 h-7 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:n(`activity:mailbox.backToChat`),children:(0,E.jsx)(a,{className:`h-4 w-4`})}),(0,E.jsx)(`div`,{className:S(`p-1.5 rounded-md shrink-0`,r.completed?`bg-green-100 dark:bg-green-950/40`:`bg-amber-100 dark:bg-amber-950/40`),children:(0,E.jsx)(s,{className:S(`h-4 w-4`,r.completed?`text-green-600 dark:text-green-400`:`text-amber-600 dark:text-amber-400`)})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:r.subject}),r.completed&&(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] font-medium text-green-600 dark:text-green-400 shrink-0`,children:[(0,E.jsx)(y,{className:`h-3 w-3`}),n(`activity:mailbox.completed`)]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground mt-0.5`,children:[(0,E.jsx)(`span`,{className:`font-medium text-foreground/80`,children:r.from}),(0,E.jsx)(`span`,{children:`→`}),(0,E.jsx)(`span`,{children:r.to===`*`||r.to===`all`?n(`activity:mailbox.everyone`):r.to}),(0,E.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,E.jsx)(v,{className:`h-3 w-3`}),A(r.timestamp)]})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:o,className:`flex items-center justify-center w-7 h-7 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors shrink-0`,title:n(`activity:mailbox.closeTitle`),children:(0,E.jsx)(c,{className:`h-4 w-4`})})]}),(0,E.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:(0,E.jsx)(`div`,{className:`px-4 py-4`,children:(0,E.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,E.jsx)(t,{components:w,children:r.body})})})}),(0,E.jsxs)(`div`,{className:`border-t border-border bg-card/30 px-4 py-3 shrink-0`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(p,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{children:u})]}),(0,E.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,E.jsx)(`span`,{className:S(`px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase`,d),children:r.priority||`normal`})}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(h,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,title:r.from,children:r.from})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,E.jsx)(v,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{children:k(r.timestamp)})]}),r.replyTo&&(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,E.jsx)(b,{className:`h-3 w-3 shrink-0`}),(0,E.jsx)(`span`,{className:`truncate`,children:n(`activity:mailbox.replyTo`,{id:r.replyTo})})]}),r.completed&&r.completedBy&&(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,E.jsx)(y,{className:`h-3 w-3 shrink-0 text-green-500`}),(0,E.jsx)(`span`,{children:r.completedAt?n(`activity:mailbox.completedByAt`,{name:r.completedBy,time:k(r.completedAt)}):n(`activity:mailbox.completedBy`,{name:r.completedBy})})]}),r.outcome&&(0,E.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.outcome`)}),(0,E.jsx)(`span`,{children:r.outcome})]}),r.taskContext&&(0,E.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,E.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:n(`activity:mailbox.task`)}),(0,E.jsx)(`span`,{children:r.taskContext})]})]}),Object.keys(r.readBy??{}).length>0&&(0,E.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,E.jsx)(M,{readBy:r.readBy})})]})]})}export{N as MailboxDetailView};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{c as t,m as n,p as r,s as i}from"./markdown-D0X23O-i.js";import{$ as a,$n as o,Ar as s,En as c,Mr as l,Nt as u,T as d,X as f,br as p,ci as m,cn as h,di as g,et as _,it as v,jt as y,ni as b,pt as x,rr as S,rt as C,sn as w,sr as T,tn as E,vr as ee,wn as D,yn as te}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{s as ne}from"./ws-client-BAV7SLzK.js";import{t as re}from"./session-store-DN1UYDL9.js";import{t as O}from"./utils-DBns3uMk.js";import{A as k,F as A,M as j,P as M,S as ie,c as ae,d as N,f as P,j as oe,l as se,u as F}from"./index-BhO3caLf.js";import{a as ce,c as I,d as le,f as ue,h as L,i as de,l as fe,m as R,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye}from"./xyflow-D5_yey7w.js";var z=e(n(),1),B=r();function V(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/100);return t<600?`${(t/10).toFixed(1)}s`:`${Math.floor(t/600)}m ${Math.round(t%600/10)}s`}var be={user:{Icon:v,labelKey:`activity:message.roleYou`,avatarBg:`bg-primary`,avatarColor:`text-primary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-primary/20`,bubbleBg:`bg-primary`,bubbleBorder:`border-transparent`,textColor:`text-primary-foreground`},assistant:{Icon:p,labelKey:`activity:message.roleAssistant`,avatarBg:`bg-accent`,avatarColor:`text-accent-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-accent/20`,bubbleBg:`bg-card`,bubbleBorder:`border-border`,textColor:`text-foreground`},tool:{Icon:x,labelKey:`activity:message.roleTool`,avatarBg:`bg-secondary`,avatarColor:`text-secondary-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-secondary/20`,bubbleBg:`bg-muted/80`,bubbleBorder:`border-border`,textColor:`text-foreground`},system:{Icon:p,labelKey:`activity:transcript.kindSystem`,avatarBg:`bg-muted`,avatarColor:`text-muted-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-muted/20`,bubbleBg:`bg-muted/50`,bubbleBorder:`border-border`,textColor:`text-muted-foreground`},error:{Icon:b,labelKey:`activity:transcript.kindError`,avatarBg:`bg-destructive`,avatarColor:`text-destructive-foreground`,avatarRing:`ring-2 ring-offset-2 ring-offset-background ring-destructive/20`,bubbleBg:`bg-destructive/5`,bubbleBorder:`border-destructive/20`,textColor:`text-destructive`}};function H({entry:e}){let{t:n}=m();return e.role===`error`?(0,B.jsx)(se,{text:e.text}):e.role===`tool`?(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 tool-details`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground`,children:[(0,B.jsx)(x,{className:`h-3 w-3`}),(0,B.jsx)(`span`,{className:`font-mono`,children:e.tool??n(`activity:watch.toolFallback`)}),e.durationMs!==void 0&&(0,B.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground font-normal tabular-nums`,children:[(0,B.jsx)(T,{className:`h-3 w-3 inline mr-0.5 align-text-bottom`}),V(e.durationMs)]})]}),e.input!==void 0&&e.input!==null&&(0,B.jsx)(`div`,{className:`p-3 bg-muted/50 rounded-lg overflow-x-auto`,children:(0,B.jsx)(ae,{input:e.input})}),e.output!==void 0&&e.output!==null?(0,B.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:typeof e.output==`string`?(0,B.jsx)(t,{remarkPlugins:[i],rehypePlugins:P,components:N,children:e.output}):(0,B.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs bg-card rounded-lg p-2 border border-border overflow-x-auto`,children:JSON.stringify(e.output,null,2)})}):e.text?(0,B.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,B.jsx)(t,{remarkPlugins:[i],rehypePlugins:P,components:N,children:e.text})}):null,e.isError&&(0,B.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-destructive`,children:n(`activity:watch.toolFailed`)}),e.text&&(0,B.jsx)(`pre`,{className:`mt-1 text-xs whitespace-pre-wrap text-destructive/80`,children:e.text})]})]}):(0,B.jsx)(`div`,{className:`text-sm leading-relaxed markdown-content`,children:(0,B.jsx)(t,{remarkPlugins:[i],rehypePlugins:P,components:N,children:e.text})})}function xe({entry:e,isContinuation:t=!1}){let{t:n}=m(),r=be[e.role],i=r.Icon;return(0,B.jsxs)(`div`,{className:`group flex gap-3 animate-message msg-bubble rounded-lg transition-shadow`,children:[t?(0,B.jsx)(`div`,{className:`flex-shrink-0 w-8`}):(0,B.jsx)(`div`,{className:O(`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center`,r.avatarBg,r.avatarColor,r.avatarRing),children:(0,B.jsx)(i,{className:`h-4 w-4`})}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0 flex-1`,children:[!t&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:O(`text-xs font-medium`,r.textColor),children:e.role===`tool`&&e.tool?e.tool:n(r.labelKey)}),(0,B.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}),e.role===`tool`&&e.durationMs!==void 0&&(0,B.jsxs)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[`· `,V(e.durationMs)]})]}),(0,B.jsx)(`div`,{className:O(`rounded-2xl px-4 py-3 border`,e.role===`user`&&`rounded-br-md`,e.role===`assistant`&&`rounded-bl-md`,e.role===`tool`&&`rounded-bl-sm`,e.role===`system`&&`rounded-bl-sm opacity-70`,e.role===`error`&&`rounded-bl-sm`,r.bubbleBg,r.bubbleBorder),children:(0,B.jsx)(`div`,{className:O(`text-sm leading-relaxed markdown-content`,r.textColor),children:(0,B.jsx)(H,{entry:e})})}),e.text&&e.role!==`error`&&(0,B.jsx)(`div`,{className:`opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,B.jsx)(F,{text:e.text,label:n(`common:action.copy`)})})]})]})}var Se=[`steer`,`ask`,`assign`,`note`],U=2500;function Ce({sessionId:e,limit:t=200}){let[n,r]=(0,z.useState)(null),{t:i}=m(),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(null),[h,_]=(0,z.useState)(`steer`),[v,y]=(0,z.useState)(`high`),[b,x]=(0,z.useState)([]),[S,C]=(0,z.useState)(!1),w=(0,z.useRef)(null),T=(0,z.useRef)(!0),E=(0,z.useRef)(!0),ee=oe(e=>e.liveSessions),D=(0,z.useMemo)(()=>ee.find(t=>t.sessionId===e),[ee,e]),te=(0,z.useMemo)(()=>{let e=D;return e?`${e.status}|${e.agents.map(e=>`${e.id}:${e.status}:${e.toolCalls??0}:${e.iterations??0}`).join(`,`)}`:``},[D]),ne=D?.status===`active`||(D?.agents.some(e=>e.status===`running`||e.status===`streaming`)??!1),re=(0,z.useMemo)(()=>{if(!D)return null;let e=D.agents.find(e=>e.status===`running`||e.status===`streaming`);return e?.currentTool?`🔧 ${e.currentTool}`:e?i(`activity:sessionWatch.working`,{name:e.name??e.id}):null},[D,i]),k=(0,z.useMemo)(()=>{if(!D)return null;let e=D.agents.find(e=>e.partialText&&(e.status===`streaming`||e.status===`running`))??D.agents.find(e=>e.partialText);return e?.partialText?{label:e.id===`leader`?i(`activity:sessionWatch.claude`):e.name||e.id,text:e.partialText}:null},[D,i]),A=(0,z.useCallback)(async()=>{try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/events?limit=${t}`);if(!n.ok)throw Error(`HTTP ${n.status}`);let i=await n.json();E.current&&(r(i),o(null))}catch(e){E.current&&o(e instanceof Error?e.message:String(e))}},[e,t]),j=(0,z.useCallback)(async()=>{try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/mailbox`);if(!t.ok)return;let n=await t.json();E.current&&Array.isArray(n.thread)&&x(n.thread)}catch{}},[e]);(0,z.useEffect)(()=>{E.current=!0,r(null),o(null),x([]),A(),j();let e=setInterval(()=>void A(),U),t=setInterval(()=>void j(),U);return()=>{E.current=!1,clearInterval(e),clearInterval(t)}},[A,j]),(0,z.useEffect)(()=>{te&&A()},[te,A]),(0,z.useEffect)(()=>{T.current&&w.current&&(w.current.scrollTop=w.current.scrollHeight)},[n,k]);let M=()=>{let e=w.current;e&&(T.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)},ie=async()=>{let t=s.trim();if(!(!t||l)){u(!0),f(null);try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t,type:h,priority:v})});if(!n.ok)throw Error(`HTTP ${n.status}`);c(``),f(ne?g.t(`activity:sessionWatch.sentRunning`):g.t(`activity:sessionWatch.sentIdle`)),j()}catch(e){f(g.t(`activity:sessionWatch.sentFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{u(!1)}}},ae=async()=>{if(!S){C(!0),f(null);try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reason:g.t(`activity:sessionWatch.interruptReason`)})});if(!t.ok)throw Error(`HTTP ${t.status}`);f(g.t(`activity:sessionWatch.interruptSent`)),j()}catch(e){f(g.t(`activity:sessionWatch.interruptFailed`,{error:e instanceof Error?e.message:String(e)}))}finally{C(!1)}}},N=n?.entries??[];return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5 shrink-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:O(`h-1.5 w-1.5 rounded-full`,ne?`bg-green-500 animate-pulse`:`bg-muted-foreground`)}),i(`activity:sessionWatch.liveStream`)]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,B.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[i(`activity:sessionWatch.events`,{count:n.total}),` · `,n.status]}),ne&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>void ae(),disabled:S,title:i(`activity:sessionWatch.interruptTitle`),className:`rounded border border-destructive/40 bg-destructive/15 px-1.5 py-0.5 text-[10px] text-destructive hover:bg-destructive/25 disabled:opacity-40 transition-colors`,children:i(S?`activity:sessionWatch.interrupting`:`activity:sessionWatch.interrupt`)})]})]}),re&&(0,B.jsxs)(`div`,{className:`mb-1.5 shrink-0 text-[10px] text-foreground truncate`,children:[`▶ `,re]}),a&&(0,B.jsxs)(`div`,{className:`text-[11px] text-destructive mb-1 shrink-0`,children:[`· `,a]}),(0,B.jsxs)(`div`,{ref:w,onScroll:M,className:`min-h-0 min-w-0 flex-1 overflow-y-auto space-y-1.5 pr-1`,children:[N.length===0&&!a&&(0,B.jsx)(`div`,{className:`text-[11px] text-muted-foreground italic`,children:i(`activity:sessionWatch.loading`)}),N.map((e,t)=>(0,B.jsx)(xe,{entry:e,isContinuation:t>0&&N[t-1].role===e.role},`${e.ts}-${t}`)),k&&(0,B.jsxs)(`div`,{className:`flex gap-3 animate-message`,children:[(0,B.jsx)(`div`,{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center bg-accent text-accent-foreground ring-2 ring-offset-2 ring-offset-background ring-accent/20`,children:(0,B.jsx)(p,{className:`h-4 w-4 animate-pulse`})}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5 max-w-[85%] min-w-0`,children:[(0,B.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground px-1`,children:k.label}),(0,B.jsx)(`div`,{className:`rounded-2xl rounded-bl-md px-4 py-3 bg-card border border-border`,children:(0,B.jsxs)(`span`,{className:`text-sm leading-relaxed text-foreground whitespace-pre-wrap break-words`,children:[k.text,(0,B.jsx)(`span`,{className:`animate-pulse text-primary`,children:`▋`})]})})]})]})]}),b.length>0&&(0,B.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0 max-h-28 overflow-y-auto space-y-1`,children:[(0,B.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:i(`activity:mailbox.messages`)}),b.slice(-6).map(e=>{let t=e.completed?i(`activity:sessionWatch.done`):e.readByLeader?i(`activity:sessionWatch.read`):i(`activity:sessionWatch.delivered`);return(0,B.jsxs)(`div`,{className:`text-[10px] leading-snug`,children:[(0,B.jsx)(`span`,{className:O(`font-semibold mr-1.5`,e.fromLeader?`text-accent`:`text-primary`),children:e.fromLeader?i(`activity:sessionWatch.agent`):i(`activity:sessionWatch.you`)}),(0,B.jsx)(`span`,{className:`text-foreground whitespace-pre-wrap break-words`,children:e.body}),!e.fromLeader&&(0,B.jsx)(`span`,{className:O(`ml-1.5 text-[9px]`,e.completed?`text-green-500`:e.readByLeader?`text-cyan-500`:`text-muted-foreground`),children:t})]},e.id)})]}),(0,B.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border shrink-0`,children:[(0,B.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,B.jsx)(`select`,{value:h,onChange:e=>_(e.target.value),title:i(`activity:sessionWatch.msgType.${h}Hint`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:Se.map(e=>(0,B.jsx)(`option`,{value:e,children:i(`activity:sessionWatch.msgType.${e}Label`)},e))}),(0,B.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),title:i(`activity:sessionWatch.priority`),className:`rounded bg-muted border border-border px-1.5 py-0.5 text-[10px] text-foreground focus:outline-none focus:ring-1 focus:ring-ring`,children:[(0,B.jsx)(`option`,{value:`high`,children:`high`}),(0,B.jsx)(`option`,{value:`normal`,children:`normal`}),(0,B.jsx)(`option`,{value:`low`,children:`low`})]})]}),(0,B.jsxs)(`div`,{className:`flex items-end gap-1.5`,children:[(0,B.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ie())},rows:2,placeholder:i(`activity:sessionWatch.placeholder`,{label:i(`activity:sessionWatch.msgType.${h}Label`)}),className:`flex-1 resize-none rounded-md bg-muted border border-border px-2 py-1 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void ie(),disabled:l||!s.trim(),className:`shrink-0 rounded-md bg-primary text-primary-foreground px-2.5 py-1.5 text-xs hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:l?`…`:i(`activity:sessionWatch.send`)})]}),d&&(0,B.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground`,children:d}),(0,B.jsx)(`div`,{className:`mt-0.5 text-[9px] text-muted-foreground`,children:i(`activity:sessionWatch.sendHint`)})]})]})}function W(e){return e==null||!Number.isFinite(e)?`0`:e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function we(e,t){if(!e)return`never`;let n=Date.parse(e);if(!Number.isFinite(n))return`never`;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s ago`:r<3600?`${Math.round(r/60)}m ago`:r<86400?`${Math.round(r/3600)}h ago`:`${Math.round(r/86400)}d ago`}function Te(e,t){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`${r}s`:r<3600?`${Math.round(r/60)}m`:`${Math.round(r/3600)}h`}function Ee(e){if(!e)return;let t=e.split(`/`);return t[t.length-1]?.slice(0,18)}function De(e,t=380){let n=new Map,r=Math.max(1,e.length);return e.forEach((e,i)=>{let a=(i-(r-1)/2)*t;n.set(e,600+a)}),n}function Oe(e,t,n){let r=Math.min(3,n),i=Math.floor(t/r),a=t%r;return{x:e-(Math.min(r,n-i*r)-1)*190/2+a*190,y:640+i*150}}function ke(e){return e===`tui`?`tui`:e===`repl`||e===`cli`?`repl`:`webui`}function Ae(e){return e===`tui`?`TUI`:e===`repl`?`REPL`:`WebUI`}function G(e){switch(e){case`running`:case`active`:return`active`;case`idle`:return`idle`;case`completed`:return`completed`;case`failed`:case`error`:return`error`;case`stopped`:return`offline`;default:return`idle`}}function je(e,t){let n=new Set,r=[];for(let i of e){let e=ke(i.clientType),a=`client-${i.pid??i.sessionId}`,o=[],s=!1;for(let e of i.agents){n.add(e.id);let r=t.get(e.id),i=G(r?.status??e.status);(i===`active`||i===`streaming`)&&(s=!0),o.push({officeId:`${a}__agent-${e.id}`,serverId:e.id,name:r?.name??e.name??e.id,status:i,iteration:r?.iteration??e.iterations??0,toolCalls:r?.toolCalls??e.toolCalls??0,costUsd:r?.costUsd??e.costUsd??0,tokensIn:r?.tokensIn??e.tokensIn??0,tokensOut:r?.tokensOut??e.tokensOut??0,ctxPct:r?.ctxPct??e.ctxPct,model:r?.model??e.model,lastActivityAt:e.lastActivityAt,currentTask:r?.currentTool??r?.lastTool??e.currentTool})}let c=i.status===`closing`||i.status===`stale`?`offline`:s?`active`:`idle`;r.push({id:a,type:e,label:i.projectName||Ae(e),sublabel:[Ae(e),i.gitBranch?`⎇ ${i.gitBranch}`:``,i.pid?`pid ${i.pid}`:``].filter(Boolean).join(` · `),status:c,sessionId:i.sessionId,pid:i.pid,branch:i.gitBranch,workingDir:i.workingDir,startedAt:i.startedAt,agents:o})}let i=[...t.values()].filter(e=>!n.has(e.id));if(i.length>0){let e=r.find(e=>e.type===`webui`);e||(e={id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI`,status:`idle`,agents:[]},r.push(e));for(let t of i){let n=G(t.status);(n===`active`||n===`streaming`)&&(e.status=`active`),e.agents.push({officeId:`${e.id}__agent-${t.id}`,serverId:t.id,name:t.name,status:n,iteration:t.iteration??0,toolCalls:t.toolCalls??0,costUsd:t.costUsd??0,tokensIn:t.tokensIn??0,tokensOut:t.tokensOut??0,ctxPct:t.ctxPct,model:t.model,currentTask:t.currentTool??t.lastTool})}}return r.length===0&&r.push({id:`client-self`,type:`webui`,label:`This WebUI`,sublabel:`Web UI · connecting…`,status:`idle`,agents:[]}),r}function K(e){return e.startsWith(`tool`)?`#eab308`:e.startsWith(`mailbox`)?`#06b6d4`:e.startsWith(`provider`)?`#a855f7`:e.startsWith(`agent`)||e.startsWith(`subagent`)?`#22c55e`:e.includes(`error`)?`#ef4444`:`#6366f1`}function Me(e){return Math.min(100,Math.max(0,e??0))}function q({status:e,small:t,activity:n=0}){let r=t?`w-2 h-2`:`w-3 h-3`,i=t?4+n*4:6+n*6;return(0,B.jsx)(`span`,{className:O(`rounded-full`,r,n>0&&`animate-pulse`,{idle:`bg-gray-500`,active:`bg-emerald-500`,streaming:`bg-blue-500`,completed:`bg-blue-500`,error:`bg-red-500`,offline:`bg-gray-600`}[e]),style:{boxShadow:n>0?`0 0 ${i}px ${{idle:`#9ca3af`,active:`#22c55e`,streaming:`#3b82f6`,completed:`#3b82f6`,error:`#ef4444`,offline:`#6b7280`}[e]}`:void 0}})}function Ne(){let{t:e}=m(),{clientCounts:t,currentSession:n,totalAgents:r,activeAgents:i,aggregate:a}=oe(d(e=>({clientCounts:e.clientCounts,currentSession:e.currentSession,totalAgents:e.totalAgents,activeAgents:e.activeAgents,aggregate:e.aggregate}))),s=t.tui+t.webui+t.repl,u=e=>e?.toLocaleString()??`0`;return(0,B.jsxs)(`div`,{className:`absolute top-20 left-4 z-10 bg-slate-800/95 backdrop-blur border border-slate-700 rounded-lg p-3 shadow-xl`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,B.jsx)(l,{className:`h-3.5 w-3.5 text-emerald-400`}),(0,B.jsx)(`span`,{className:`text-[10px] font-bold text-gray-300 uppercase tracking-wide`,children:e(`activity:office.sessionStats`)})]}),(0,B.jsxs)(`div`,{className:`space-y-1.5 text-[10px]`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(C,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.clients`)})]}),(0,B.jsxs)(`span`,{className:`text-gray-200 font-mono`,children:[i,` `,(0,B.jsx)(`span`,{className:`text-gray-500`,children:`/`}),` `,(0,B.jsx)(`span`,{className:`text-emerald-400`,children:s})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 pl-4 text-[9px]`,children:[t.tui>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(x,{className:`h-2.5 w-2.5 text-emerald-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:`TUI`}),(0,B.jsx)(`span`,{className:`text-emerald-400 font-mono`,children:t.tui})]}),t.webui>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(E,{className:`h-2.5 w-2.5 text-blue-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:`WebUI`}),(0,B.jsx)(`span`,{className:`text-blue-400 font-mono`,children:t.webui})]}),t.repl>0&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(x,{className:`h-2.5 w-2.5 text-amber-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:`REPL`}),(0,B.jsx)(`span`,{className:`text-amber-400 font-mono`,children:t.repl})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(p,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:officeMap.agents`)})]}),(0,B.jsxs)(`span`,{className:`text-gray-200 font-mono`,children:[i,` `,(0,B.jsx)(`span`,{className:`text-gray-500`,children:`/`}),` `,(0,B.jsx)(`span`,{className:`text-cyan-400`,children:r})]})]}),n.model&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(S,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:officeMap.model`)})]}),(0,B.jsx)(`span`,{className:`text-cyan-400 font-mono truncate max-w-[120px]`,title:n.model,children:n.model.split(`/`).pop()?.slice(0,16)})]}),n.mode&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(f,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:officeMap.mode`)})]}),(0,B.jsx)(`span`,{className:O(`font-mono uppercase text-[9px] px-1.5 py-0.5 rounded`,n.mode===`auto`&&`bg-purple-500/20 text-purple-400`,n.mode===`suggest`&&`bg-blue-500/20 text-blue-400`,n.mode===`off`&&`bg-gray-500/20 text-gray-400`,![`auto`,`suggest`,`off`].includes(n.mode||``)&&`bg-gray-500/20 text-gray-400`),children:n.mode})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(c,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.toolCallsLabel`)})]}),(0,B.jsx)(`span`,{className:`text-yellow-400 font-mono`,children:u(a.toolCalls)})]}),(0,B.jsxs)(`div`,{className:`border-t border-slate-700 pt-1.5 mt-1.5 space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-gray-500 text-[8px]`,children:`IN`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.input`)})]}),(0,B.jsx)(`span`,{className:`text-gray-300 font-mono text-[9px]`,children:u(a.tokensIn)})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-gray-500 text-[8px]`,children:`OUT`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.output`)})]}),(0,B.jsx)(`span`,{className:`text-gray-300 font-mono text-[9px]`,children:u(a.tokensOut)})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-slate-700 pt-1.5 mt-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(o,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.cost`)})]}),(0,B.jsx)(`span`,{className:`text-emerald-400 font-mono font-medium`,children:(e=>e==null?`$0.0000`:`$${e.toFixed(4)}`)(a.costUsd)})]})]})]})}function J(){let e={opacity:0,width:1,height:1,minWidth:0,border:`none`,background:`transparent`};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(ce,{type:`target`,position:R.Top,style:e,isConnectable:!1}),(0,B.jsx)(ce,{type:`source`,position:R.Bottom,style:e,isConnectable:!1})]})}function Y({data:e}){let{t}=m();return(0,B.jsxs)(`div`,{className:`mt-2 flex items-center justify-between border-t border-white/5 pt-1.5 text-[8px] text-gray-500`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`font-mono text-gray-300`,children:e.agentCount??0}),` `,t(`activity:office.agentsSuffix`)]}),e.startedAt&&(0,B.jsx)(`span`,{children:t(`activity:office.upPrefix`,{time:Te(e.startedAt,Date.now())})})]})}function Pe({data:e}){let{t}=m(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`offline`,o=e.color||`#3b82f6`;return(0,B.jsxs)(`div`,{className:O(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-blue-500/20`,r&&`border-red-500/50 bg-red-500/10`,i&&`border-gray-500/30 bg-gray-500/5 opacity-60`,!n&&!r&&!i&&`border-blue-500/30 bg-blue-500/10`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:O(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-blue-500/20`:`bg-blue-500/10`),children:(0,B.jsx)(E,{className:`h-5 w-5`,style:{color:o}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:o},children:e.label}),(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500`,children:t(`activity:office.webuiClient`)})]}),(0,B.jsx)(q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,B.jsx)(`div`,{className:`text-[10px] text-gray-400 mb-2 truncate`,children:e.sublabel}),(0,B.jsx)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-500`,children:i?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{className:`h-3 w-3 text-gray-500`}),(0,B.jsx)(`span`,{children:t(`activity:office.disconnected`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a,{className:`h-3 w-3 text-emerald-500`}),(0,B.jsx)(`span`,{children:t(`activity:office.connected`)})]})}),n&&(0,B.jsx)(`div`,{className:`mt-2 h-1 rounded-full bg-blue-500/30 overflow-hidden`,children:(0,B.jsx)(`div`,{className:`h-full bg-blue-500 animate-pulse`,style:{width:`60%`}})}),(0,B.jsx)(Y,{data:e})]})}function X({data:e}){let{t}=m(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.color||`#22c55e`;return(0,B.jsxs)(`div`,{className:O(`rounded-xl border-2 p-4 min-w-[180px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-emerald-500/20`,r&&`border-red-500/50 bg-red-500/10`,!n&&!r&&`border-emerald-500/30 bg-emerald-500/10`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:O(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-emerald-500/20`:`bg-emerald-500/10`),children:(0,B.jsx)(x,{className:`h-5 w-5`,style:{color:i}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:i},children:e.label}),(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500`,children:t(`activity:office.tuiClient`)})]}),(0,B.jsx)(q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,B.jsx)(`div`,{className:`text-[10px] text-gray-400 mb-2 truncate`,children:e.sublabel}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-gray-500`,children:[(0,B.jsx)(x,{className:`h-3 w-3 text-emerald-500`}),(0,B.jsx)(`span`,{children:t(`activity:office.terminal`)})]}),(0,B.jsx)(Y,{data:e})]})}function Fe({data:e}){let{t}=m(),n=e.status===`active`||e.status===`streaming`,r=e.color||`#f59e0b`;return(0,B.jsxs)(`div`,{className:O(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,n&&`shadow-lg shadow-amber-500/20`,!n&&`border-amber-500/30 bg-amber-500/10`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:O(`flex items-center justify-center w-10 h-10 rounded-lg`,n?`bg-amber-500/20`:`bg-amber-500/10`),children:(0,B.jsx)(x,{className:`h-5 w-5`,style:{color:r}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-xs font-bold truncate`,style:{color:r},children:e.label}),(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500`,children:t(`activity:office.repl`)})]}),(0,B.jsx)(q,{status:e.status,activity:e.vizActivity??0})]}),e.sublabel&&(0,B.jsx)(`div`,{className:`text-[10px] text-gray-400 mb-1 truncate`,children:e.sublabel}),(0,B.jsx)(Y,{data:e})]})}function Ie({data:e}){let{t}=m(),n=e.status===`active`||e.status===`streaming`,r=e.color||`#a855f7`;return(0,B.jsxs)(`div`,{className:`rounded-xl border-2 p-4 min-w-[200px] transition-all backdrop-blur-sm relative bg-slate-900/90`,children:[(0,B.jsx)(J,{}),(0,B.jsx)(`div`,{className:`absolute -top-3 left-1/2 -translate-x-1/2 px-2 py-0.5 bg-purple-600 text-white text-[9px] rounded-full font-bold`,children:t(`activity:office.coordinator`)}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-3 mt-2`,children:[(0,B.jsx)(`div`,{className:O(`flex items-center justify-center w-12 h-12 rounded-xl`,n?`bg-purple-500/20`:`bg-purple-500/10`),children:(0,B.jsx)(S,{className:`h-6 w-6`,style:{color:r}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-sm font-bold truncate`,style:{color:r},children:e.label}),(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500`,children:e.sublabel||t(`activity:office.fleetSummary`)})]}),(0,B.jsx)(q,{status:e.status,activity:e.vizActivity??0})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] mb-2`,children:[(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsxs)(`div`,{className:`font-mono`,children:[(0,B.jsx)(`span`,{className:`text-emerald-400`,children:e.agentsActive||0}),(0,B.jsx)(`span`,{className:`text-gray-500`,children:` / `}),(0,B.jsx)(`span`,{className:`text-purple-400`,children:e.agentsTotal||0})]}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:officeMap.agents`)})]}),(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsx)(`div`,{className:`font-mono text-yellow-400`,children:(e.toolCalls||0).toLocaleString()}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:office.toolCallsLabel`)})]}),(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsx)(`div`,{className:`font-mono text-gray-300`,children:W(e.tokensIn)}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:office.tokensLabel`)})]}),(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsxs)(`div`,{className:`font-mono text-emerald-400`,children:[`$`,(e.costUsd||0).toFixed(3)]}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:office.cost`)})]})]}),n&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-purple-400`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-purple-400 animate-pulse`}),t(`activity:office.coordinatingFleet`)]})]})}function Le({data:e}){let{t}=m(),n=e.status===`active`||e.status===`streaming`,r=e.status===`error`,i=e.status===`completed`,a=e.color||`#06b6d4`,o=Me(e.ctxPct);return(0,B.jsxs)(`div`,{className:O(`rounded-lg border p-3 min-w-[150px] transition-all backdrop-blur-sm`,n&&`border-cyan-500/50 bg-cyan-500/10 shadow-lg shadow-cyan-500/10`,r&&`border-red-500/50 bg-red-500/10`,i&&`border-gray-500/30 bg-gray-500/5`,!n&&!r&&!i&&`border-cyan-500/30 bg-cyan-500/10`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,B.jsx)(p,{className:`h-4 w-4 shrink-0`,style:{color:a}}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-[11px] font-bold truncate`,style:{color:a},children:e.label}),e.model&&(0,B.jsx)(`div`,{className:`text-[8px] text-gray-500 truncate`,children:Ee(e.model)})]}),(0,B.jsx)(q,{status:e.status,small:!0,activity:e.vizActivity??0})]}),e.currentTask&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-cyan-300/90 truncate mb-1.5`,children:[(0,B.jsx)(`span`,{className:O(`w-1.5 h-1.5 rounded-full bg-cyan-400 shrink-0`,n&&`animate-pulse`)}),(0,B.jsx)(`span`,{className:`truncate font-mono`,children:e.currentTask})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-0.5 text-[9px] mb-1.5`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`iter`}),(0,B.jsx)(`span`,{className:`text-gray-300 font-mono`,children:e.iteration||0})]}),(0,B.jsxs)(`div`,{className:`flex justify-between`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`tools`}),(0,B.jsx)(`span`,{className:`text-yellow-400/90 font-mono`,children:e.toolCalls||0})]}),(0,B.jsxs)(`div`,{className:`flex justify-between`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`tok`}),(0,B.jsx)(`span`,{className:`text-gray-300 font-mono`,children:W((e.tokensIn||0)+(e.tokensOut||0))})]}),(0,B.jsxs)(`div`,{className:`flex justify-between`,children:[(0,B.jsx)(`span`,{className:`text-gray-500`,children:`cost`}),(0,B.jsxs)(`span`,{className:`text-emerald-400/90 font-mono`,children:[`$`,(e.costUsd||0).toFixed(3)]})]})]}),o>0&&(0,B.jsxs)(`div`,{className:`mb-1`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[8px] text-gray-500 mb-0.5`,children:[(0,B.jsx)(`span`,{children:`ctx`}),(0,B.jsxs)(`span`,{className:O(`font-mono`,o>=90?`text-red-400`:o>=70?`text-amber-400`:`text-gray-400`),children:[o,`%`]})]}),(0,B.jsx)(`div`,{className:`h-1 rounded-full bg-slate-700/60 overflow-hidden`,children:(0,B.jsx)(`div`,{className:O(`h-full`,o>=90?`bg-red-500`:o>=70?`bg-amber-500`:`bg-cyan-500`),style:{width:`${o}%`}})})]}),e.lastActivityAt&&(0,B.jsxs)(`div`,{className:O(`flex items-center gap-1 text-[8px]`,n?`text-gray-600`:`text-gray-500`),children:[i&&(0,B.jsx)(`span`,{className:`text-emerald-500/70`,children:t(`activity:office.donePrefix`)}),r&&(0,B.jsx)(`span`,{className:`text-red-400/80`,children:t(`activity:office.failedPrefix`)}),(0,B.jsx)(`span`,{children:t(`activity:office.seenPrefix`,{time:we(e.lastActivityAt,Date.now())})})]})]})}function Z({data:e}){let{t}=m();return(0,B.jsxs)(`div`,{className:O(`rounded-lg border border-dashed p-3 min-w-[120px] transition-all opacity-40`,`border-gray-600 bg-gray-800/30`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,B.jsx)(s,{className:`h-4 w-4 text-gray-600`}),(0,B.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500 truncate`,children:e.label})}),(0,B.jsx)(q,{status:e.status,small:!0,activity:e.vizActivity??0})]}),(0,B.jsx)(`div`,{className:`text-[9px] text-gray-600`,children:t(`activity:office.availableDesk`)})]})}function Q({data:e}){let{t}=m(),n=e.color||`#eab308`,r=(e.unreadCount||0)>0;return(0,B.jsxs)(`div`,{className:O(`rounded-xl border-2 p-4 min-w-[160px] transition-all backdrop-blur-sm`,r&&`border-yellow-500/50 bg-yellow-500/10 shadow-lg shadow-yellow-500/10`,!r&&`border-yellow-500/30 bg-yellow-500/5`),children:[(0,B.jsx)(J,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3 mb-3`,children:[(0,B.jsx)(`div`,{className:O(`flex items-center justify-center w-10 h-10 rounded-lg`,r?`bg-yellow-500/20`:`bg-yellow-500/10`),children:(0,B.jsx)(h,{className:`h-5 w-5`,style:{color:n}})}),(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,B.jsx)(`div`,{className:`text-xs font-bold`,style:{color:n},children:t(`activity:office.mailboxHub`)}),(0,B.jsx)(`div`,{className:`text-[10px] text-gray-500`,children:r?t(`activity:office.unreadSuffix`,{count:e.unreadCount||0}):t(`activity:office.allClear`)})]}),r&&(0,B.jsx)(`div`,{className:`w-5 h-5 rounded-full bg-yellow-500 text-black text-[10px] font-bold flex items-center justify-center`,children:e.unreadCount})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px]`,children:[(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-yellow-400`,children:[(0,B.jsx)(y,{className:`h-3 w-3`}),(0,B.jsx)(`span`,{children:e.messageCount||0})]}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:office.total`)})]}),(0,B.jsxs)(`div`,{className:`bg-black/20 rounded p-1.5 text-center`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-emerald-400`,children:[(0,B.jsx)(D,{className:`h-3 w-3`}),(0,B.jsx)(`span`,{children:e.unreadCount||0})]}),(0,B.jsx)(`div`,{className:`text-gray-500`,children:t(`activity:office.unreadLabel`)})]})]}),e.sublabel&&(0,B.jsxs)(`div`,{className:`mt-2 truncate border-t border-white/5 pt-1.5 text-[9px] text-gray-400`,children:[`✉ `,e.sublabel]})]})}var Re={webui:Pe,tui:X,repl:Fe,coordinator:Ie,agent:Le,mailbox:Q,desk:Z},ze={wire:({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i,targetPosition:a,data:o,selected:s})=>{let c=o?.color||`#6366f1`,l=k(e=>e.animateEdges),u=o?.animated&&l?Math.max(.15,o?.intensity??.6):0,[d,f,p]=L({sourceX:e,sourceY:t,sourcePosition:i??R.Bottom,targetX:n,targetY:r,targetPosition:a??R.Top,curvature:.28}),m=5+u*7,h=5+u*4,g=m+h,_=`${Math.max(.5,1.6-u).toFixed(2)}s`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:s?2.5:1.4,strokeOpacity:s?.9:.28,className:`react-flow__edge-path`}),u>.05&&(0,B.jsx)(`path`,{d,fill:`none`,stroke:c,strokeWidth:2.2,strokeOpacity:.45+u*.5,strokeDasharray:`${m} ${h}`,strokeLinecap:`round`,style:{filter:`drop-shadow(0 0 ${2+u*4}px ${c})`},children:(0,B.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:g,to:`0`,dur:_,repeatCount:`indefinite`})}),o?.label&&u>.1&&(0,B.jsx)(de,{children:(0,B.jsx)(`div`,{style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${f}px, ${p}px)`},className:`pointer-events-none rounded-full border border-white/15 bg-slate-800/90 px-1.5 py-0.5 text-[8px] font-medium text-white/85 backdrop-blur-sm`,children:o.label})})]})}};function Be({events:e,now:t}){let{t:n}=m(),r=e.slice(0,14);return(0,B.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 z-10 pointer-events-none px-3 pb-3`,children:(0,B.jsxs)(`div`,{className:`pointer-events-auto rounded-lg bg-slate-900/85 border border-slate-700/70 backdrop-blur px-3 py-2 max-w-3xl mx-auto`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5 text-[10px] uppercase tracking-wide text-cyan-400/80`,children:[(0,B.jsx)(l,{className:`h-3 w-3`}),n(`activity:office.liveActivity`)]}),r.length===0?(0,B.jsx)(`div`,{className:`text-[11px] text-gray-500 italic`,children:n(`activity:office.waitingActivity`)}):(0,B.jsx)(`div`,{className:`flex flex-col gap-0.5 max-h-32 overflow-hidden`,children:r.map(e=>{let r=Math.max(0,Math.round((t-e.timestamp)/1e3));return(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] leading-tight`,children:[(0,B.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{backgroundColor:K(e.kind)}}),(0,B.jsx)(`span`,{className:`text-gray-300 truncate flex-1`,children:e.label}),(0,B.jsx)(`span`,{className:`text-gray-600 shrink-0 tabular-nums`,children:r<1?n(`activity:office.now`):`${r}s`})]},e.id)})})]})})}function $(){let{t:e}=m(),{fitView:t}=he(),n=ne(e=>e.events),r=A(e=>e.agents),i=A(e=>e.agentTranscripts),a=A(e=>e.leaderId),o=oe(e=>e.liveSessions),s=j(e=>e.messages),c=re(e=>e.session),l=(0,z.useMemo)(()=>je(o,r),[o,r]),d=k(e=>e.showHud),f=k(e=>e.showLegend),g=k(e=>e.showMinimap),_=k(e=>e.showControls),v=k(e=>e.showFeed),b=k(e=>e.setShowFeed),C=k(e=>e.background),[T,D,ae]=ue([]),[N,P,se]=le([]),[F,ce]=(0,z.useState)(null),[I,L]=(0,z.useState)(null),[de,R]=(0,z.useState)(!1),[V,be]=(0,z.useState)(``),[H,xe]=(0,z.useState)(!1),[Se,U]=(0,z.useState)(null),ke=(0,z.useMemo)(()=>{if(F?.data.kind!==`agent`)return M;let e=F.data.serverId??(F.id.includes(`__agent-`)?F.id.split(`__agent-`).pop():F.id.replace(/^agent-/,``));return e?i.get(e)??M:M},[i,F]),G=(0,z.useCallback)(async()=>{let e=V.trim();if(!(!e||H)){xe(!0),U(null);try{let t=await fetch(`/api/fleet/broadcast`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e})});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();be(``),U(`Delivered to ${n.delivered??0}/${n.targets??0} session(s)`)}catch(e){U(`Failed: ${e instanceof Error?e.message:String(e)}`)}finally{xe(!1)}}},[V,H]),K=(0,z.useRef)(new Map),q=4e3,J=(0,z.useRef)(new Map),Y=(0,z.useRef)(new Map),Pe=(0,z.useRef)(new Map),X=(0,z.useRef)(new Map),Fe=(0,z.useRef)(``);(0,z.useEffect)(()=>{let n=[],i=[],o=Date.now(),c=Math.max(1,...l.map(e=>e.agents.length||1)),u=Math.max(380,Math.min(3,c)*190+80),d=De(l.map(e=>e.id),u),f=s.filter(e=>!e.completed&&(e.readByCount??0)===0).length,p=s.length?[...s].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp))[0]:void 0;n.push({id:`mailbox`,type:`mailbox`,position:{x:830,y:50},data:{label:e(`activity:office.mailboxHub`),kind:`mailbox`,status:f>0?`active`:`idle`,unreadCount:f,messageCount:s.length,sublabel:p?`${p.from} → ${p.to}: ${p.subject}`:void 0,color:`#eab308`}});let m=0,h=0,g=0,_=0,v=0;for(let e of l)for(let t of e.agents)h+=1,(t.status===`active`||t.status===`streaming`)&&(m+=1),g+=t.toolCalls,_+=t.costUsd,v+=t.tokensIn+t.tokensOut;let y=a?r.get(a):null,b=m>0;n.push({id:`coordinator`,type:`coordinator`,position:{x:370,y:50},data:{label:e(`activity:office.fleetHqLabel`),sublabel:e(`activity:office.clientsSuffix`,{count:l.length}),kind:`coordinator`,status:y?.status===`failed`?`error`:b?`active`:`idle`,connections:l.length,agentsActive:m,agentsTotal:h,toolCalls:g,costUsd:_,tokensIn:v,color:`#a855f7`}});let x={tui:`#22c55e`,webui:`#3b82f6`,repl:`#f59e0b`};for(let t of l){let r=d.get(t.id)??600,a=x[t.type],s=t.status===`active`;if(n.push({id:t.id,type:t.type,position:{x:r,y:370},data:{label:t.label,sublabel:t.sublabel,kind:t.type,status:t.status,sessionId:t.sessionId,pid:t.pid,branch:t.branch,workingDir:t.workingDir,startedAt:t.startedAt,agentCount:t.agents.length,color:a}}),i.push({id:`${t.id}->coordinator`,source:t.id,target:`coordinator`,type:`wire`,animated:s,data:{color:a,animated:s,label:e(`activity:office.controlLabel`),flowType:`task`}}),i.push({id:`mailbox->${t.id}`,source:`mailbox`,target:t.id,type:`wire`,animated:f>0,data:{color:`#eab308`,animated:f>0,label:f>0?`${f}`:void 0,flowType:`mail`}}),t.agents.length===0){n.push({id:`desk-${t.id}`,type:`desk`,position:{x:r,y:640},data:{label:e(`activity:office.idleDesk`),kind:`agent`,status:`idle`,color:`#374151`}});continue}t.agents.forEach((a,s)=>{let c=a.status===`active`||a.status===`streaming`,l=X.current.get(a.serverId);if(l&&(a.toolCalls>l.toolCalls||a.iteration>l.iteration)||c){K.current.set(a.officeId,o+q);let e=Y.current.get(a.officeId)??0;Y.current.set(a.officeId,Math.min(1,e+(1-e)*.5));for(let e of[`${t.id}->${a.officeId}`,`${t.id}->coordinator`]){let t=J.current.get(e)??0;J.current.set(e,Math.min(1,t+.5))}}X.current.set(a.serverId,{toolCalls:a.toolCalls,iteration:a.iteration}),n.push({id:a.officeId,type:`agent`,position:Oe(r,s,t.agents.length),data:{label:a.name,kind:`agent`,status:a.status,serverId:a.serverId,sessionId:t.sessionId,currentTask:a.currentTask,iteration:a.iteration,toolCalls:a.toolCalls,costUsd:a.costUsd,tokensIn:a.tokensIn,tokensOut:a.tokensOut,ctxPct:a.ctxPct,model:a.model,lastActivityAt:a.lastActivityAt,color:`#06b6d4`}}),i.push({id:`${t.id}->${a.officeId}`,source:t.id,target:a.officeId,type:`wire`,animated:c,data:{color:`#06b6d4`,animated:c,label:c?a.currentTask??e(`activity:office.taskFallback`):void 0,flowType:`task`}})})}let S=new Set(l.flatMap(e=>e.agents.map(e=>e.serverId)));for(let e of[...X.current.keys()])S.has(e)||X.current.delete(e);let C=n.map(e=>{let t=K.current.get(e.id),n=Y.current.get(e.id)??0;return t&&t>o&&e.data.status!==`error`&&e.data.status!==`offline`?{...e,data:{...e.data,status:`active`,vizActivity:n}}:{...e,data:{...e.data,vizActivity:n}}}),w=i.map(e=>{let t=J.current.get(e.id)??0;return t>.05?{...e,animated:!0,data:{...e.data,animated:!0,intensity:t}}:e}),T=new Map;for(let e of C)T.set(e.id,{...e.position});Pe.current=T,D(C),P(w);let E=C.map(e=>e.id).sort().join(`|`);if(E!==Fe.current){Fe.current=E;let e=setTimeout(()=>t({padding:.2,duration:300}),50);return()=>clearTimeout(e)}},[l,a,r,s,c,q,D,P,t]);let Ie=l.flatMap(e=>e.agents.map(t=>({clientId:e.id,clientType:e.type,officeId:t.officeId,serverId:t.serverId}))),Le=l.map(e=>e.id),Z=new Map;for(let e of Ie)(!Z.has(e.serverId)||e.clientType===`webui`)&&Z.set(e.serverId,e.officeId);function Q(e){return Z.get(e)??`agent-${e}`}function $(e){let t=e.split(`__agent-`)[0];return t&&t!==e?`${t}->${e}`:`coordinator->${e}`}function Ve(e){switch(e.kind){case`mailbox:send`:case`mailbox:deliver`:return{nodes:[`mailbox`],edges:e.kind===`mailbox:send`?Le.map(e=>`mailbox->${e}`):[],status:`active`};case`agent:spawned`:{let t=Q(e.source);return{nodes:[`coordinator`,t],edges:[$(t)],status:`active`}}case`agent:tool`:case`tool:started`:case`tool:progress`:{let t=Q(e.source);return{nodes:[`coordinator`,t],edges:[$(t)],status:e.kind===`tool:progress`||e.kind===`tool:started`?`streaming`:`active`}}case`tool:executed`:{let t=Q(e.target??e.source);return{nodes:[t],edges:[$(t)],status:`active`}}case`provider:call`:case`provider:delta`:case`provider:response`:return{nodes:[`coordinator`],edges:[],status:e.kind===`provider:delta`?`streaming`:`active`};case`iteration:start`:case`iteration:end`:return{nodes:[`coordinator`],edges:Ie.map(e=>$(e.officeId)),status:e.kind===`iteration:start`?`streaming`:`active`};case`agent:text`:{let t=Q(e.source);return{nodes:[t],edges:[$(t)],status:`streaming`}}case`agent:status`:{let t=Q(e.source);return{nodes:[`coordinator`,t],edges:[$(t)],status:e.data&&typeof e.data==`object`&&`status`in e.data&&String(e.data.status)===`failed`?`error`:`completed`}}case`agent:ctx`:return{nodes:[Q(e.source)],edges:[],status:`active`};case`budget:extended`:return{nodes:[`coordinator`,Q(e.source)],edges:[],status:`active`};case`context:compacted`:case`context:repaired`:return{nodes:[`coordinator`],edges:[],status:`active`};case`error`:return{nodes:e.source?[Q(e.source)]:[],edges:[],status:`error`};case`cost:update`:return{nodes:[`coordinator`],edges:[],status:`active`};case`fleet:snapshot`:{let t=e.data?.sessions??[],n=[`coordinator`];for(let e of t)if(e.agents)for(let t of e.agents){let e=Q(t.id);n.includes(e)||n.push(e)}return{nodes:n,edges:[],status:`active`}}default:return{nodes:[],edges:[],status:`idle`}}}(0,z.useEffect)(()=>{if(n.length===0)return;let e=n[0];if(!e)return;let{nodes:t,edges:r,status:i}=Ve(e),a=Date.now();t.length>0&&(t.forEach(e=>{K.current.set(e,a+q);let t=Y.current.get(e)??0;Y.current.set(e,Math.min(1,t+(1-t)*.5))}),D(e=>e.map(e=>t.includes(e.id)?{...e,data:{...e.data,status:i,vizActivity:Y.current.get(e.id)??0}}:e))),r.length>0&&(r.forEach(e=>{let t=J.current.get(e)??0;J.current.set(e,Math.min(1,t+.5))}),P(e=>e.map(e=>r.includes(e.id)?{...e,animated:!0,data:{...e.data,animated:!0,intensity:J.current.get(e.id)??1}}:e)))},[n,D,P,q,r]),(0,z.useEffect)(()=>{let e=setInterval(()=>{let e=new Map,t=!1;for(let[n,r]of J.current){let i=r*.85;i<.05?(J.current.delete(n),e.set(n,{intensity:0,animated:!1}),t=!0):(J.current.set(n,i),e.set(n,{intensity:i,animated:!0}),t=!0)}t&&P(t=>t.map(t=>{let n=e.get(t.id);return n?{...t,animated:n.animated,data:{...t.data,animated:n.animated,intensity:n.intensity}}:t}));let n=new Map,r=!1;for(let[e,t]of Y.current){let i=t*.9;i<.03?(Y.current.delete(e),n.set(e,0),r=!0):(Y.current.set(e,i),n.set(e,i),r=!0)}r&&D(e=>e.map(e=>{let t=n.get(e.id);return t===void 0?e:{...e,data:{...e.data,vizActivity:t}}}))},1e3);return()=>clearInterval(e)},[P,D]);let He=(0,z.useCallback)(e=>P(t=>fe({...e,type:`wire`},t)),[P]),Ue=(0,z.useCallback)((e,t)=>{ce(t)},[]),We=(0,z.useCallback)(()=>{ce(null)},[]);(0,z.useEffect)(()=>{if(!I)return;let e=e=>{e.key===`Escape`&&L(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[I]);let Ge=(0,z.useCallback)(()=>{D(e=>e.map(e=>{let t=Pe.current.get(e.id);return t?{...e,position:{...t}}:e})),setTimeout(()=>t({padding:.2,duration:300}),50)},[D,t]),[,Ke]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=setInterval(()=>Ke(e=>e+1),2e3);return()=>clearInterval(e)},[]),(0,B.jsxs)(`div`,{className:`w-full h-full bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 relative overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`absolute inset-0 opacity-[0.03]`,style:{backgroundImage:`
2
+ linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
3
+ linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px)
4
+ `,backgroundSize:`40px 40px`}}),d&&(0,B.jsx)(Ne,{}),(0,B.jsx)(`div`,{className:`absolute top-3 left-1/2 -translate-x-1/2 z-10`,children:(0,B.jsx)(`div`,{className:`bg-slate-800/90 backdrop-blur px-4 py-2 rounded-lg border border-slate-700 shadow-xl`,children:(0,B.jsxs)(`div`,{className:`text-xs font-bold text-slate-300 flex items-center gap-2`,children:[(0,B.jsx)(ee,{className:`h-4 w-4 text-purple-400`}),e(`activity:office.fleetHq`),(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-pulse ml-2`}),(0,B.jsx)(`span`,{className:`text-[10px] text-gray-400 font-normal`,children:e(`activity:office.live`)})]})})}),f&&(0,B.jsxs)(`div`,{className:`absolute bottom-4 left-4 z-10 bg-slate-800/90 backdrop-blur rounded-lg border border-slate-700 p-3 text-[10px]`,children:[(0,B.jsx)(`div`,{className:`font-bold text-gray-300 mb-2`,children:e(`activity:office.legendStatus`)}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500 animate-pulse`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendActive`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-gray-500`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendIdle`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-red-500 animate-pulse`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendError`)})]})]})]}),f&&(0,B.jsxs)(`div`,{className:`absolute bottom-4 right-4 z-10 bg-slate-800/90 backdrop-blur rounded-lg border border-slate-700 p-3 text-[10px]`,children:[(0,B.jsx)(`div`,{className:`font-bold text-gray-300 mb-2`,children:e(`activity:office.legendConnections`)}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-yellow-400`,children:`✉`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendMail`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-purple-400`,children:`→`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendTask`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-emerald-400`,children:`●`}),(0,B.jsx)(`span`,{className:`text-gray-400`,children:e(`activity:office.legendStatusConn`)})]})]})]}),(0,B.jsxs)(ye,{nodes:T,edges:N,onNodesChange:ae,onEdgesChange:se,onConnect:He,onNodeClick:Ue,onPaneClick:We,nodeTypes:Re,edgeTypes:ze,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:1.5,defaultEdgeOptions:{type:`wire`},proOptions:{hideAttribution:!0},children:[(0,B.jsxs)(_e,{position:`top-right`,className:`flex items-center gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:Ge,title:e(`activity:office.arrangeTitle`),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md bg-slate-800/90 border border-slate-700 text-xs text-slate-200 hover:bg-slate-700 transition-colors`,children:[(0,B.jsx)(te,{className:`h-3.5 w-3.5`}),e(`activity:office.arrange`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>b(!v),title:e(`activity:office.feedTitle`),className:O(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,v?`bg-cyan-500/20 border-cyan-500/40 text-cyan-300`:`bg-slate-800/90 border-slate-700 text-slate-300 hover:bg-slate-700`),children:[(0,B.jsx)(u,{className:`h-3.5 w-3.5`}),e(`activity:office.feed`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>R(e=>!e),title:e(`activity:office.broadcastTitle`),className:O(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border text-xs transition-colors`,de?`bg-amber-500/20 border-amber-500/40 text-amber-300`:`bg-slate-800/90 border-slate-700 text-slate-300 hover:bg-slate-700`),children:[(0,B.jsx)(y,{className:`h-3.5 w-3.5`}),e(`activity:office.broadcast`)]})]}),C!==`none`&&(0,B.jsx)(ve,{variant:C===`lines`?pe.Lines:C===`cross`?pe.Cross:pe.Dots,gap:20,size:1,color:`rgba(255,255,255,0.05)`}),_&&(0,B.jsx)(ge,{className:`bg-slate-800 border border-slate-700 rounded-lg [&>button]:bg-slate-700 [&>button]:text-slate-200`}),g&&(0,B.jsx)(me,{className:`bg-slate-800/90 border border-slate-700 rounded-lg`,nodeColor:e=>{switch(e.data.kind){case`coordinator`:return`#a855f7`;case`webui`:return`#3b82f6`;case`tui`:return`#22c55e`;case`repl`:return`#f59e0b`;case`mailbox`:return`#eab308`;case`agent`:return`#06b6d4`;default:return`#6366f1`}},maskColor:`rgba(0,0,0,0.8)`})]}),v&&(0,B.jsx)(Be,{events:n,now:Date.now()}),de&&(0,B.jsxs)(`div`,{className:`absolute top-16 right-4 z-30 w-80 rounded-lg border border-amber-500/40 bg-slate-900/97 p-3 shadow-2xl backdrop-blur`,children:[(0,B.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold text-amber-300`,children:[(0,B.jsx)(y,{className:`h-3.5 w-3.5`}),` `,e(`activity:office.broadcastToAll`)]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>R(!1),className:`text-gray-400 hover:text-white text-base leading-none`,children:`×`})]}),(0,B.jsx)(`textarea`,{value:V,onChange:e=>be(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),G())},rows:3,placeholder:e(`activity:office.broadcastPlaceholder`),className:`w-full resize-none rounded-md border border-slate-700 bg-slate-900/70 px-2 py-1 text-[11px] text-gray-200 placeholder:text-gray-600 focus:border-amber-500/50 focus:outline-none`}),(0,B.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-gray-600`,children:e(`activity:office.broadcastSendHint`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void G(),disabled:H||!V.trim(),className:`rounded-md border border-amber-500/40 bg-amber-500/20 px-2.5 py-1 text-[11px] text-amber-200 transition-colors hover:bg-amber-500/30 disabled:cursor-not-allowed disabled:opacity-40`,children:H?`…`:e(`activity:office.broadcast`)})]}),Se&&(0,B.jsx)(`div`,{className:`mt-1 text-[10px] text-gray-400`,children:Se})]}),F&&(0,B.jsxs)(`div`,{className:O(`absolute top-20 right-4 bg-background border border-border rounded-lg p-4 shadow-xl z-20`,F.data.kind===`agent`?`w-[28rem] max-w-[calc(100%-2rem)]`:F.data.sessionId?`w-80`:`w-64`),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F.data.kind===`webui`&&(0,B.jsx)(E,{className:`h-4 w-4 text-blue-500`}),F.data.kind===`tui`&&(0,B.jsx)(x,{className:`h-4 w-4 text-emerald-500`}),F.data.kind===`coordinator`&&(0,B.jsx)(S,{className:`h-4 w-4 text-purple-500`}),F.data.kind===`agent`&&(0,B.jsx)(p,{className:`h-4 w-4 text-cyan-500`}),F.data.kind===`mailbox`&&(0,B.jsx)(h,{className:`h-4 w-4 text-yellow-500`}),(0,B.jsx)(`span`,{className:`text-sm font-bold text-foreground`,children:F.data.label})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[F.data.sessionId&&(0,B.jsx)(`button`,{type:`button`,title:e(`activity:office.openFullView`),onClick:()=>L({sessionId:F.data.sessionId,label:F.data.label}),className:`text-muted-foreground hover:text-primary`,children:(0,B.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,B.jsx)(`button`,{onClick:We,className:`text-muted-foreground hover:text-foreground text-lg leading-none`,children:`×`})]})]}),(()=>{let t=F.data,n=Date.now(),r=({k:e,v:t,accent:n})=>(0,B.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e}),(0,B.jsx)(`span`,{className:O(`font-mono truncate text-right`,n??`text-foreground/80`),children:t})]}),i=t.kind===`agent`,a=t.kind===`webui`||t.kind===`tui`||t.kind===`repl`,o=(t.tokensIn||0)+(t.tokensOut||0),c=Me(t.ctxPct);return(0,B.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,B.jsx)(r,{k:`Status`,v:String(t.status).toUpperCase(),accent:O(t.status===`active`&&`text-emerald-600 dark:text-emerald-400`,t.status===`streaming`&&`text-blue-600 dark:text-blue-400`,t.status===`error`&&`text-destructive`,t.status===`idle`&&`text-muted-foreground`,t.status===`offline`&&`text-muted-foreground/50`)}),i&&(0,B.jsxs)(B.Fragment,{children:[t.model&&(0,B.jsx)(r,{k:`Model`,v:Ee(t.model),accent:`text-cyan-600 dark:text-cyan-400`}),t.currentTask&&(0,B.jsx)(r,{k:`Tool`,v:t.currentTask,accent:`text-cyan-600 dark:text-cyan-400`}),(0,B.jsx)(r,{k:`Iterations`,v:t.iteration||0,accent:`text-cyan-600 dark:text-cyan-400`}),(0,B.jsx)(r,{k:`Tool calls`,v:t.toolCalls||0,accent:`text-amber-600 dark:text-amber-400`}),(0,B.jsx)(r,{k:`Tokens in`,v:W(t.tokensIn)}),(0,B.jsx)(r,{k:`Tokens out`,v:W(t.tokensOut)}),(0,B.jsx)(r,{k:`Tokens total`,v:W(o)}),c>0&&(0,B.jsx)(r,{k:`Context`,v:`${c}%`,accent:c>=90?`text-destructive`:c>=70?`text-amber-600 dark:text-amber-400`:`text-foreground/70`}),(0,B.jsx)(r,{k:`Cost`,v:`$${(t.costUsd||0).toFixed(4)}`,accent:`text-emerald-600 dark:text-emerald-400`}),t.lastActivityAt&&(0,B.jsx)(r,{k:`Last seen`,v:we(t.lastActivityAt,n),accent:`text-muted-foreground`}),(0,B.jsx)(`div`,{className:`pt-2`,children:(0,B.jsx)(ie,{entries:ke,agentName:t.label,compact:!0,maxHeightClassName:`max-h-64`})})]}),a&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{k:`Surface`,v:Ae(t.kind),accent:`text-foreground/80`}),t.branch&&(0,B.jsx)(r,{k:`Branch`,v:`⎇ ${t.branch}`,accent:`text-foreground/70`}),t.pid!=null&&(0,B.jsx)(r,{k:`PID`,v:t.pid}),t.workingDir&&(0,B.jsx)(r,{k:`Dir`,v:t.workingDir,accent:`text-muted-foreground`}),(0,B.jsx)(r,{k:`Agents`,v:t.agentCount??0,accent:`text-cyan-600 dark:text-cyan-400`}),t.startedAt&&(0,B.jsx)(r,{k:`Uptime`,v:Te(t.startedAt,n),accent:`text-foreground/70`})]}),t.kind===`mailbox`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{k:`Total messages`,v:t.messageCount||0,accent:`text-amber-600 dark:text-amber-400`}),(0,B.jsx)(r,{k:`Unread`,v:t.unreadCount||0,accent:`text-amber-600 dark:text-amber-400`}),s.length>0&&(0,B.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-border pt-2`,children:[(0,B.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e(`activity:office.recent`)}),[...s].sort((e,t)=>Date.parse(t.timestamp)-Date.parse(e.timestamp)).slice(0,6).map(t=>(0,B.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[10px]`,children:[(0,B.jsx)(`span`,{className:O(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,!t.completed&&(t.readByCount??0)===0?`bg-amber-500`:t.completed?`bg-emerald-500`:`bg-muted`)}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`truncate text-foreground/80`,children:t.subject||e(`activity:office.noSubject`)}),(0,B.jsxs)(`div`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:[t.from,` → `,t.to,` · `,we(t.timestamp,n)]})]})]},t.id))]})]}),t.kind===`coordinator`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{k:`Connections`,v:t.connections||0,accent:`text-purple-600 dark:text-purple-400`}),(0,B.jsx)(r,{k:`Iterations`,v:t.iteration||0,accent:`text-purple-600 dark:text-purple-400`})]}),(i||a)&&t.sessionId&&(0,B.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 h-72`,children:(0,B.jsx)(Ce,{sessionId:t.sessionId})})]})})()]}),I&&(0,B.jsxs)(`div`,{className:`absolute inset-y-0 right-0 z-30 flex w-[min(680px,92%)] flex-col border-l border-border bg-background shadow-2xl`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2.5 shrink-0 bg-card`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(p,{className:`h-4 w-4 text-primary shrink-0`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`div`,{className:`truncate text-sm font-bold text-foreground`,children:I.label}),(0,B.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e(`activity:office.fullOperationStream`)})]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>L(null),title:e(`activity:office.closeEsc`),className:`text-muted-foreground hover:text-foreground text-xl leading-none shrink-0`,children:`×`})]}),(0,B.jsx)(`div`,{className:`flex-1 min-h-0 p-4`,children:(0,B.jsx)(Ce,{sessionId:I.sessionId,limit:500})})]})]})}function Ve(){return(0,B.jsx)(I,{children:(0,B.jsx)($,{})})}export{Ve as OfficeMapPanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{bt as r,pt as i,si as a,wt as o}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{t as s}from"./utils-sFCTikqz.js";import{C as c,g as l,h as u,m as d,y as f}from"./index-BSuiEQIC.js";var p=e(t(),1),m=n();function h({open:e,onClose:t,className:n}){let{t:h}=a(),[g,_]=(0,p.useState)([]),v=c(),y=(0,p.useRef)(null),b=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(!(!e||!v.client?.isConnected))return v.client.send?.({type:`process.list`}),y.current=v.client.on?.(`process.list`,e=>{let t=e?.payload;t?.processes&&_(t.processes)})??null,b.current=setInterval(()=>{v.client.send?.({type:`process.list`})},3e3),()=>{y.current?.(),b.current&&clearInterval(b.current)}},[e,v.client]);let x=(0,p.useCallback)(e=>{v.client.send?.({type:`process.kill`,payload:{pid:e}})},[v.client]),S=(0,p.useCallback)(()=>{v.client.send?.({type:`process.killAll`})},[v.client]),C=g.filter(e=>e.status===`running`);return(0,m.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,m.jsxs)(u,{className:s(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[75dvh] pt-[10dvh]`,n),showCloseButton:!1,children:[(0,m.jsx)(f,{className:`sr-only`,children:h(`activity:process.heading`)}),(0,m.jsx)(l,{className:`sr-only`,children:h(`activity:process.subtitle`,{active:C.length,total:g.length})}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,m.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400`,children:(0,m.jsx)(i,{className:`h-4 w-4`})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold`,children:h(`activity:process.heading`)}),(0,m.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:h(`activity:process.subtitle`,{active:C.length,total:g.length})})]})]}),(0,m.jsx)(`div`,{className:`flex items-center gap-1`,children:C.length>0&&(0,m.jsxs)(`button`,{type:`button`,onClick:S,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,children:[(0,m.jsx)(r,{className:`h-3 w-3 fill-current`}),h(`activity:process.killAll`)]})})]}),(0,m.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:g.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,m.jsx)(i,{className:`h-10 w-10 opacity-15`}),(0,m.jsx)(`p`,{className:`text-sm font-medium`,children:h(`activity:process.emptyTitle`)}),(0,m.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:h(`activity:process.emptyBody`)})]}):(0,m.jsx)(`div`,{className:`divide-y`,children:g.map(e=>{let t=e.status===`running`?Math.floor((Date.now()-e.startedAt)/1e3):null,n=t?t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`:null,i=e.protected===!0;return(0,m.jsxs)(`div`,{className:s(`flex items-center justify-between px-4 py-3 text-xs transition-colors`,e.status===`running`?`bg-background hover:bg-muted/30`:`bg-muted/20 text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,m.jsx)(`span`,{className:s(`led shrink-0`,e.status===`running`?i?`text-blue-400`:`text-[hsl(var(--success))] led-pulse`:`text-muted-foreground`)}),(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:h(`activity:process.pidLabel`,{pid:e.pid})}),(0,m.jsx)(`span`,{className:`font-medium truncate`,children:e.tool}),i&&(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1 py-0.5 rounded text-[9px] bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium shrink-0`,title:h(`activity:process.protectedTitle`),children:[(0,m.jsx)(o,{className:`h-2.5 w-2.5`}),h(`activity:process.protected`)]})]}),(0,m.jsx)(`code`,{className:`text-[10px] text-muted-foreground/70 truncate block mt-0.5 font-mono`,children:e.command})]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0 ml-3`,children:[n&&(0,m.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:n}),e.status===`running`&&!i&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>x(e.pid),className:`p-1.5 rounded-md hover:bg-destructive/10 hover:text-destructive transition-colors`,title:h(`activity:process.killTitle`,{pid:e.pid}),children:(0,m.jsx)(r,{className:`h-3.5 w-3.5 fill-current`})})]})]},e.pid)})})})]})})}export{h as ProcessMonitor};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{m as t,p as n}from"./markdown-D0X23O-i.js";import{bt as r,ci as i,pt as a,wt as o}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as s}from"./utils-DBns3uMk.js";import{C as c,g as l,h as u,m as d,y as f}from"./index-BhO3caLf.js";var p=e(t(),1),m=n();function h({open:e,onClose:t,className:n}){let{t:h}=i(),[g,_]=(0,p.useState)([]),v=c(),y=(0,p.useRef)(null),b=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(!(!e||!v.client?.isConnected))return v.client.send?.({type:`process.list`}),y.current=v.client.on?.(`process.list`,e=>{let t=e?.payload;t?.processes&&_(t.processes)})??null,b.current=setInterval(()=>{v.client.send?.({type:`process.list`})},3e3),()=>{y.current?.(),b.current&&clearInterval(b.current)}},[e,v.client]);let x=(0,p.useCallback)(e=>{v.client.send?.({type:`process.kill`,payload:{pid:e}})},[v.client]),S=(0,p.useCallback)(()=>{v.client.send?.({type:`process.killAll`})},[v.client]),C=g.filter(e=>e.status===`running`);return(0,m.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,m.jsxs)(u,{className:s(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[75dvh] pt-[10dvh]`,n),showCloseButton:!1,children:[(0,m.jsx)(f,{className:`sr-only`,children:h(`activity:process.heading`)}),(0,m.jsx)(l,{className:`sr-only`,children:h(`activity:process.subtitle`,{active:C.length,total:g.length})}),(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,m.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400`,children:(0,m.jsx)(a,{className:`h-4 w-4`})}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:`text-sm font-semibold`,children:h(`activity:process.heading`)}),(0,m.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:h(`activity:process.subtitle`,{active:C.length,total:g.length})})]})]}),(0,m.jsx)(`div`,{className:`flex items-center gap-1`,children:C.length>0&&(0,m.jsxs)(`button`,{type:`button`,onClick:S,className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,children:[(0,m.jsx)(r,{className:`h-3 w-3 fill-current`}),h(`activity:process.killAll`)]})})]}),(0,m.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:g.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,m.jsx)(a,{className:`h-10 w-10 opacity-15`}),(0,m.jsx)(`p`,{className:`text-sm font-medium`,children:h(`activity:process.emptyTitle`)}),(0,m.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:h(`activity:process.emptyBody`)})]}):(0,m.jsx)(`div`,{className:`divide-y`,children:g.map(e=>{let t=e.status===`running`?Math.floor((Date.now()-e.startedAt)/1e3):null,n=t?t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`:null,i=e.protected===!0;return(0,m.jsxs)(`div`,{className:s(`flex items-center justify-between px-4 py-3 text-xs transition-colors`,e.status===`running`?`bg-background hover:bg-muted/30`:`bg-muted/20 text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,m.jsx)(`span`,{className:s(`led shrink-0`,e.status===`running`?i?`text-blue-400`:`text-[hsl(var(--success))] led-pulse`:`text-muted-foreground`)}),(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground shrink-0`,children:h(`activity:process.pidLabel`,{pid:e.pid})}),(0,m.jsx)(`span`,{className:`font-medium truncate`,children:e.tool}),i&&(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1 py-0.5 rounded text-[9px] bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium shrink-0`,title:h(`activity:process.protectedTitle`),children:[(0,m.jsx)(o,{className:`h-2.5 w-2.5`}),h(`activity:process.protected`)]})]}),(0,m.jsx)(`code`,{className:`text-[10px] text-muted-foreground/70 truncate block mt-0.5 font-mono`,children:e.command})]})]}),(0,m.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0 ml-3`,children:[n&&(0,m.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:n}),e.status===`running`&&!i&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>x(e.pid),className:`p-1.5 rounded-md hover:bg-destructive/10 hover:text-destructive transition-colors`,title:h(`activity:process.killTitle`,{pid:e.pid}),children:(0,m.jsx)(r,{className:`h-3.5 w-3.5 fill-current`})})]})]},e.pid)})})})]})})}export{h as ProcessMonitor};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-YPRVJGbn.js";import{m as n,p as r}from"./markdown-D0X23O-i.js";import{Z as i,dt as a,ii as o,mn as s,ri as c,si as l}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{t as u}from"./utils-sFCTikqz.js";import{g as d,h as f,m as p,y as m}from"./index-BSuiEQIC.js";var h=e(n(),1),g=r(),_={btw:{label:`btw`,titleKey:`btwTitle`,tone:`bg-sky-500/10 text-sky-700 dark:text-sky-300 border-sky-500/30`},steer:{label:`steer`,titleKey:`steerTitle`,tone:`bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/30`},queue:{label:`queue`,titleKey:`queueTitle`,tone:`bg-indigo-500/10 text-indigo-700 dark:text-indigo-300 border-indigo-500/30`}};function v({open:e,onClose:n,className:r}){let{t:v}=l(),y=t(e=>e.queue),b=t(e=>e.removeQueued),x=t(e=>e.clearQueue),[S,C]=(0,h.useState)(`oldest`),w=(0,h.useCallback)(e=>{b(e)},[b]),T=(0,h.useMemo)(()=>{let e=y.map((e,t)=>({item:e,sourceIdx:t}));return e.sort((e,t)=>S===`newest`?t.item.addedAt-e.item.addedAt:e.item.addedAt-t.item.addedAt),e},[y,S]);return(0,g.jsx)(p,{open:e,onOpenChange:e=>{e||n()},children:(0,g.jsxs)(f,{className:u(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[70dvh] pt-[10dvh]`,r),showCloseButton:!1,children:[(0,g.jsx)(m,{className:`sr-only`,children:v(`activity:queue.heading`)}),(0,g.jsx)(d,{className:`sr-only`,children:v(`activity:queue.subtitle`,{count:y.length})}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,g.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-600 dark:text-indigo-400`,children:(0,g.jsx)(s,{className:`h-4 w-4`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:v(`activity:queue.heading`)}),(0,g.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:v(`activity:queue.subtitle`,{count:y.length})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>e===`newest`?`oldest`:`newest`),className:u(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors font-medium`,`text-muted-foreground hover:bg-muted hover:text-foreground`),title:v(S===`newest`?`activity:queue.sortNewestTitle`:`activity:queue.sortOldestTitle`),"data-testid":`queue-sort-toggle`,children:[S===`newest`?(0,g.jsx)(o,{className:`h-3 w-3`}):(0,g.jsx)(c,{className:`h-3 w-3`}),v(S===`newest`?`activity:queue.newest`:`activity:queue.oldest`)]}),y.length>0&&(0,g.jsxs)(`button`,{type:`button`,onClick:()=>x(),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,title:v(`activity:queue.clearTitle`),"data-testid":`queue-clear-all`,children:[(0,g.jsx)(a,{className:`h-3 w-3`}),v(`activity:queue.clear`)]})]})]}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:y.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,g.jsx)(s,{className:`h-10 w-10 opacity-15`}),(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:v(`activity:queue.emptyTitle`)}),(0,g.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:v(`activity:queue.emptyBody`)})]}):(0,g.jsx)(`ul`,{className:`divide-y`,"data-testid":`queue-list`,children:T.map(({item:e,sourceIdx:t},n)=>{let r=_[e.mode];return(0,g.jsxs)(`li`,{className:`flex items-start justify-between px-4 py-3 text-xs hover:bg-muted/30 transition-colors gap-3`,"data-testid":`queue-item`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`mt-1 text-[10px] font-mono text-muted-foreground shrink-0 w-5 text-right tabular-nums`,children:[n+1,`.`]}),(0,g.jsx)(`span`,{className:u(`shrink-0 inline-flex items-center justify-center text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded border`,r.tone),title:v(`activity:queue.${r.titleKey}`),"data-testid":`queue-mode-${e.mode}`,children:r.label}),(0,g.jsx)(`p`,{className:`text-sm text-foreground leading-relaxed min-w-0 break-words`,children:e.text.length>120?`${e.text.slice(0,117)}…`:e.text})]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>w(t),className:`ml-1 p-1.5 rounded-md shrink-0 hover:bg-destructive/10 hover:text-destructive transition-colors`,title:v(`activity:queue.removeTitle`),"data-testid":`queue-remove-${t}`,children:(0,g.jsx)(i,{className:`h-3.5 w-3.5`})})]},`${e.addedAt}-${t}`)})})}),y.length>0&&(0,g.jsx)(`div`,{className:`px-4 py-2.5 border-t shrink-0`,children:(0,g.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-center`,children:v(`activity:queue.footer`)})})]})})}export{v as QueuePanel};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CIMOL6-x.js";import{m as n,p as r}from"./markdown-D0X23O-i.js";import{Z as i,ai as a,ci as o,dt as s,hn as c,ii as l}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as u}from"./utils-DBns3uMk.js";import{g as d,h as f,m as p,y as m}from"./index-BhO3caLf.js";var h=e(n(),1),g=r(),_={btw:{label:`btw`,titleKey:`btwTitle`,tone:`bg-sky-500/10 text-sky-700 dark:text-sky-300 border-sky-500/30`},steer:{label:`steer`,titleKey:`steerTitle`,tone:`bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-500/30`},queue:{label:`queue`,titleKey:`queueTitle`,tone:`bg-indigo-500/10 text-indigo-700 dark:text-indigo-300 border-indigo-500/30`}};function v({open:e,onClose:n,className:r}){let{t:v}=o(),y=t(e=>e.queue),b=t(e=>e.removeQueued),x=t(e=>e.clearQueue),[S,C]=(0,h.useState)(`oldest`),w=(0,h.useCallback)(e=>{b(e)},[b]),T=(0,h.useMemo)(()=>{let e=y.map((e,t)=>({item:e,sourceIdx:t}));return e.sort((e,t)=>S===`newest`?t.item.addedAt-e.item.addedAt:e.item.addedAt-t.item.addedAt),e},[y,S]);return(0,g.jsx)(p,{open:e,onOpenChange:e=>{e||n()},children:(0,g.jsxs)(f,{className:u(`max-w-lg gap-0 p-0 overflow-hidden flex flex-col max-h-[70dvh] pt-[10dvh]`,r),showCloseButton:!1,children:[(0,g.jsx)(m,{className:`sr-only`,children:v(`activity:queue.heading`)}),(0,g.jsx)(d,{className:`sr-only`,children:v(`activity:queue.subtitle`,{count:y.length})}),(0,g.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b shrink-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,g.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg bg-indigo-500/10 text-indigo-600 dark:text-indigo-400`,children:(0,g.jsx)(c,{className:`h-4 w-4`})}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:v(`activity:queue.heading`)}),(0,g.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:v(`activity:queue.subtitle`,{count:y.length})})]})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>e===`newest`?`oldest`:`newest`),className:u(`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors font-medium`,`text-muted-foreground hover:bg-muted hover:text-foreground`),title:v(S===`newest`?`activity:queue.sortNewestTitle`:`activity:queue.sortOldestTitle`),"data-testid":`queue-sort-toggle`,children:[S===`newest`?(0,g.jsx)(a,{className:`h-3 w-3`}):(0,g.jsx)(l,{className:`h-3 w-3`}),v(S===`newest`?`activity:queue.newest`:`activity:queue.oldest`)]}),y.length>0&&(0,g.jsxs)(`button`,{type:`button`,onClick:()=>x(),className:`flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs text-destructive hover:bg-destructive/10 transition-colors font-medium`,title:v(`activity:queue.clearTitle`),"data-testid":`queue-clear-all`,children:[(0,g.jsx)(s,{className:`h-3 w-3`}),v(`activity:queue.clear`)]})]})]}),(0,g.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto`,children:y.length===0?(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3 text-muted-foreground`,children:[(0,g.jsx)(c,{className:`h-10 w-10 opacity-15`}),(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:v(`activity:queue.emptyTitle`)}),(0,g.jsx)(`p`,{className:`text-xs text-center max-w-xs`,children:v(`activity:queue.emptyBody`)})]}):(0,g.jsx)(`ul`,{className:`divide-y`,"data-testid":`queue-list`,children:T.map(({item:e,sourceIdx:t},n)=>{let r=_[e.mode];return(0,g.jsxs)(`li`,{className:`flex items-start justify-between px-4 py-3 text-xs hover:bg-muted/30 transition-colors gap-3`,"data-testid":`queue-item`,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-3 min-w-0 flex-1`,children:[(0,g.jsxs)(`span`,{className:`mt-1 text-[10px] font-mono text-muted-foreground shrink-0 w-5 text-right tabular-nums`,children:[n+1,`.`]}),(0,g.jsx)(`span`,{className:u(`shrink-0 inline-flex items-center justify-center text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded border`,r.tone),title:v(`activity:queue.${r.titleKey}`),"data-testid":`queue-mode-${e.mode}`,children:r.label}),(0,g.jsx)(`p`,{className:`text-sm text-foreground leading-relaxed min-w-0 break-words`,children:e.text.length>120?`${e.text.slice(0,117)}…`:e.text})]}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>w(t),className:`ml-1 p-1.5 rounded-md shrink-0 hover:bg-destructive/10 hover:text-destructive transition-colors`,title:v(`activity:queue.removeTitle`),"data-testid":`queue-remove-${t}`,children:(0,g.jsx)(i,{className:`h-3.5 w-3.5`})})]},`${e.addedAt}-${t}`)})})}),y.length>0&&(0,g.jsx)(`div`,{className:`px-4 py-2.5 border-t shrink-0`,children:(0,g.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-center`,children:v(`activity:queue.footer`)})})]})})}export{v as QueuePanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-YPRVJGbn.js";import{m as n,p as r}from"./markdown-D0X23O-i.js";import{$n as i,At as a,Ft as o,Nr as s,ei as c,jr as l,si as u,wn as d}from"./vendor-Bhf0nZ3B.js";import"./i18n-BJCOtLro.js";import{t as f}from"./session-store-Do0MGnXu.js";import{n as p}from"./ui-store-D3gGpJWY.js";var m=e(n(),1),h=r();function g(){let e=f(e=>e.session),{t:n}=u(),r=f.getState().session?.id,g=f(e=>e.projectName),x=f(e=>e.cwd),S=f(e=>e.mode),C=f(e=>e.contextMode),w=f(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=p(e=>e.currentView),k=p(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(n(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&r!==void 0?D!==r:!1;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto bg-background p-6`,children:(0,h.jsxs)(`div`,{className:`max-w-5xl mx-auto space-y-6`,children:[(0,h.jsxs)(`header`,{className:`flex items-start justify-between`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`h1`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,h.jsx)(o,{className:`w-7 h-7 text-primary`}),n(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:n(`activity:refresh.subtitle`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:I,className:`px-3 py-1.5 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90`,children:n(`activity:refresh.recordProbe`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(l,{className:`w-5 h-5`}),n(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.restoredLocal`),ok:N,extra:r?n(`activity:refresh.sessionIdExtra`,{id:r}):n(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:n(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:n(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():n(`activity:refresh.never`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(i,{className:`w-5 h-5`}),n(`activity:refresh.persistedEnv`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`projectName`,value:g||`∅`}),(0,h.jsx)(v,{label:`cwd`,value:x||`∅`,mono:!0}),(0,h.jsx)(v,{label:`mode`,value:S,mono:!0}),(0,h.jsx)(v,{label:`contextMode`,value:C,mono:!0})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(d,{className:`w-5 h-5`}),n(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?n(`activity:refresh.noMessages`):n(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:n(`activity:refresh.noBleed`),ok:!L,extra:L?n(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:r??`∅`}):n(`activity:refresh.transcriptBinds`),warn:L}),T.length>0&&(0,h.jsxs)(`div`,{className:`border rounded-lg p-3 bg-muted/40 text-xs font-mono space-y-1`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`first:`}),` `,b(T[0])]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`last:`}),` `,b(T[T.length-1]??T[0])]})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`w-5 h-5`}),n(`activity:refresh.uiWorkspace`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`currentView`,value:O,mono:!0}),(0,h.jsx)(v,{label:`dockSection`,value:k??n(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:n(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`activity:refresh.noProbes`)}):(0,h.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:A.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.ok?(0,h.jsx)(c,{className:`w-4 h-4 text-green-500 shrink-0`}):(0,h.jsx)(s,{className:`w-4 h-4 text-amber-500 shrink-0`}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)(`span`,{children:e.note})]},`${e.ts}-${t}`))})]})]})})}function _({label:e,extra:t,ok:n,warn:r}){return(0,h.jsxs)(`div`,{className:`border rounded-lg px-3 py-2 ${r?`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300`:n?`border-green-500/40 bg-green-500/10 text-green-700 dark:text-green-300`:`border-border bg-muted/40 text-muted-foreground`}`,children:[(0,h.jsxs)(`div`,{className:`text-xs font-medium flex items-center gap-2`,children:[n&&!r?(0,h.jsx)(c,{className:`w-4 h-4`}):(0,h.jsx)(s,{className:`w-4 h-4`}),e]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 break-all`,children:t})]})}function v({label:e,value:t,mono:n}){return(0,h.jsxs)(`div`,{className:`border rounded-lg p-3 bg-card`,children:[(0,h.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e}),(0,h.jsx)(`p`,{className:`mt-1 text-sm break-all `+(n?`font-mono`:`font-medium`),children:t})]})}function y(e){let t=e.title?.trim();return t?`${e.id} — "${t}" (${e.provider}/${e.model})`:`${e.id} (${e.provider}/${e.model})`}function b(e){let t=(e.content??``).trim().replace(/\s+/g,` `);return`[${e.role}] ${t.length>100?`${t.slice(0,99)}…`:t}`}export{g as RefreshDebugView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CIMOL6-x.js";import{m as n,p as r}from"./markdown-D0X23O-i.js";import{At as i,Ft as a,Mr as o,Pr as s,Tn as c,ci as l,er as u,ti as d}from"./vendor-Ch4m_qLI.js";import"./i18n-CNo6A2vu.js";import{t as f}from"./session-store-DN1UYDL9.js";import{n as p}from"./ui-store-BdOsq6T-.js";var m=e(n(),1),h=r();function g(){let e=f(e=>e.session),{t:n}=l(),r=f.getState().session?.id,g=f(e=>e.projectName),x=f(e=>e.cwd),S=f(e=>e.mode),C=f(e=>e.contextMode),w=f(e=>e.lastVisitedAt),T=t(e=>e.messages),E=t(e=>e.queue.length),D=t(e=>e.boundSessionId),O=p(e=>e.currentView),k=p(e=>e.dockSection),[A,j]=(0,m.useState)([]),M=(0,m.useMemo)(()=>{if(typeof window>`u`)return 0;let e=0;for(let t of[`wrongstack-session`,`wrongstack-chat`,`wrongstack-ui`,`wrongstack-config`]){let n=window.localStorage.getItem(t);typeof n==`string`&&(e+=n.length)}return e},[T.length]),N=typeof window<`u`&&!!window.__wrongstackSessionRehydrated,P=typeof window<`u`&&!!window.__wrongstackChatRehydrated;function F(e,t){j(n=>[{ts:Date.now(),note:e,ok:t},...n].slice(0,20))}function I(){F(n(`activity:refresh.simulatedF5`),!0)}let L=D!==null&&r!==void 0?D!==r:!1;return(0,h.jsx)(`div`,{className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto bg-background p-6`,children:(0,h.jsxs)(`div`,{className:`max-w-5xl mx-auto space-y-6`,children:[(0,h.jsxs)(`header`,{className:`flex items-start justify-between`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`h1`,{className:`text-2xl font-bold flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`w-7 h-7 text-primary`}),n(`activity:refresh.heading`)]}),(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:n(`activity:refresh.subtitle`)})]}),(0,h.jsx)(`button`,{type:`button`,onClick:I,className:`px-3 py-1.5 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90`,children:n(`activity:refresh.recordProbe`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(o,{className:`w-5 h-5`}),n(`activity:refresh.latestSession`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.restoredLocal`),ok:N,extra:r?n(`activity:refresh.sessionIdExtra`,{id:r}):n(`activity:refresh.noSessionYet`)}),(0,h.jsx)(_,{label:n(`activity:refresh.activePointer`),ok:!!e?.id,extra:e?y(e):`null`}),(0,h.jsx)(_,{label:n(`activity:refresh.lastVisited`),ok:w>0,extra:w>0?new Date(w).toISOString():n(`activity:refresh.never`)})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(u,{className:`w-5 h-5`}),n(`activity:refresh.persistedEnv`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`projectName`,value:g||`∅`}),(0,h.jsx)(v,{label:`cwd`,value:x||`∅`,mono:!0}),(0,h.jsx)(v,{label:`mode`,value:S,mono:!0}),(0,h.jsx)(v,{label:`contextMode`,value:C,mono:!0})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(c,{className:`w-5 h-5`}),n(`activity:refresh.transcriptRehydrate`)]}),(0,h.jsx)(_,{label:n(`activity:refresh.localTranscript`),ok:P&&(T.length>0||D===null),extra:T.length===0?n(`activity:refresh.noMessages`):n(`activity:refresh.messagesExtra`,{count:T.length,queued:E})}),(0,h.jsx)(_,{label:n(`activity:refresh.noBleed`),ok:!L,extra:L?n(`activity:refresh.bleedExtra`,{bound:D??`∅`,active:r??`∅`}):n(`activity:refresh.transcriptBinds`),warn:L}),T.length>0&&(0,h.jsxs)(`div`,{className:`border rounded-lg p-3 bg-muted/40 text-xs font-mono space-y-1`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`first:`}),` `,b(T[0])]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`last:`}),` `,b(T[T.length-1]??T[0])]})]})]}),(0,h.jsxs)(`section`,{className:`space-y-3`,children:[(0,h.jsxs)(`h2`,{className:`text-lg font-semibold flex items-center gap-2`,children:[(0,h.jsx)(i,{className:`w-5 h-5`}),n(`activity:refresh.uiWorkspace`)]}),(0,h.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,h.jsx)(v,{label:`currentView`,value:O,mono:!0}),(0,h.jsx)(v,{label:`dockSection`,value:k??n(`activity:refresh.noneValue`),mono:!0})]}),(0,h.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:refresh.payloadSize`,{count:M})})]}),(0,h.jsxs)(`section`,{className:`space-y-2`,children:[(0,h.jsx)(`h2`,{className:`text-lg font-semibold`,children:n(`activity:refresh.probeLog`)}),A.length===0?(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`activity:refresh.noProbes`)}):(0,h.jsx)(`ul`,{className:`space-y-1 text-xs font-mono`,children:A.map((e,t)=>(0,h.jsxs)(`li`,{className:`flex items-center gap-2`,children:[e.ok?(0,h.jsx)(d,{className:`w-4 h-4 text-green-500 shrink-0`}):(0,h.jsx)(s,{className:`w-4 h-4 text-amber-500 shrink-0`}),(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()}),(0,h.jsx)(`span`,{children:e.note})]},`${e.ts}-${t}`))})]})]})})}function _({label:e,extra:t,ok:n,warn:r}){return(0,h.jsxs)(`div`,{className:`border rounded-lg px-3 py-2 ${r?`border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300`:n?`border-green-500/40 bg-green-500/10 text-green-700 dark:text-green-300`:`border-border bg-muted/40 text-muted-foreground`}`,children:[(0,h.jsxs)(`div`,{className:`text-xs font-medium flex items-center gap-2`,children:[n&&!r?(0,h.jsx)(d,{className:`w-4 h-4`}):(0,h.jsx)(s,{className:`w-4 h-4`}),e]}),(0,h.jsx)(`div`,{className:`text-xs font-mono mt-1 break-all`,children:t})]})}function v({label:e,value:t,mono:n}){return(0,h.jsxs)(`div`,{className:`border rounded-lg p-3 bg-card`,children:[(0,h.jsx)(`p`,{className:`text-xs uppercase tracking-wide text-muted-foreground`,children:e}),(0,h.jsx)(`p`,{className:`mt-1 text-sm break-all `+(n?`font-mono`:`font-medium`),children:t})]})}function y(e){let t=e.title?.trim();return t?`${e.id} — "${t}" (${e.provider}/${e.model})`:`${e.id} (${e.provider}/${e.model})`}function b(e){let t=(e.content??``).trim().replace(/\s+/g,` `);return`[${e.role}] ${t.length>100?`${t.slice(0,99)}…`:t}`}export{g as RefreshDebugView};