@wrongstack/webui 0.302.2 → 0.303.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 (106) hide show
  1. package/dist/assets/AgentRosterView-BnnhSRau.js +9 -0
  2. package/dist/assets/{AnalyticsDashboard-C9aPEyov.js → AnalyticsDashboard-CMs176Dp.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-Bciki41o.js → AudienceMemoryPanel-BRXM47H1.js} +2 -2
  4. package/dist/assets/{ChangesView-DumffowD.js → ChangesView-DxAQY4v4.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-DPI_5S2R.js +1 -0
  6. package/dist/assets/CodeEditor-9Fu9hRrw.js +1 -0
  7. package/dist/assets/CodeMap-B7YGx2G0.js +1 -0
  8. package/dist/assets/{ConfirmModal-CdKg3EOQ.js → ConfirmModal-DXy17_uy.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-CJ7Vc1Am.js → CronJobsPanel-C_bGieGQ.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-DaeHUzc5.js → DeadCodeScanPanel-hkBvamWn.js} +2 -2
  11. package/dist/assets/{DebugDashboard-BI3EmXrM.js → DebugDashboard-CDWJ9nLR.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-DMW6Ab__.js → DesignGalleryView-BG-p6kFX.js} +1 -1
  13. package/dist/assets/GoalView-CCklBpTx.js +1 -0
  14. package/dist/assets/KanbanView-Dzvn9y79.js +3 -0
  15. package/dist/assets/MailboxDetailView-7dtt5joR.js +1 -0
  16. package/dist/assets/MemoryDrawer-D2Yq9oba.js +1 -0
  17. package/dist/assets/MemoryManager-CL5AiyKr.js +1 -0
  18. package/dist/assets/{ModelPicker-IOZSUnqM.js → ModelPicker-BazB-GbH.js} +1 -1
  19. package/dist/assets/OfficeMapPanel-Dtb75DlY.js +4 -0
  20. package/dist/assets/{ProcessMonitor-TGqyXxmB.js → ProcessMonitor-BTjaxnO-.js} +1 -1
  21. package/dist/assets/{QueuePanel-5aMgQbHv.js → QueuePanel-BOD9qtHp.js} +1 -1
  22. package/dist/assets/{RefreshDebugView-DfBYFPEF.js → RefreshDebugView-DfbZ-vgF.js} +1 -1
  23. package/dist/assets/{RequirementIntakeView-CNAFKiQ3.js → RequirementIntakeView-CeZFJlrn.js} +1 -1
  24. package/dist/assets/SageTabs-BlK58zgb.js +2 -0
  25. package/dist/assets/SddFlowGraph-DWphr6Tr.js +1 -0
  26. package/dist/assets/SddHub-ZRkMmA7e.js +2 -0
  27. package/dist/assets/{SessionInspectView-CytBw7Y9.js → SessionInspectView-DqrSHseG.js} +1 -1
  28. package/dist/assets/SessionList-DLoIKc1b.js +1 -0
  29. package/dist/assets/{SessionsDashboard-CridPbkX.js → SessionsDashboard-CUj2WSYM.js} +1 -1
  30. package/dist/assets/SetupScreen-B_2CuLeR.js +1 -0
  31. package/dist/assets/SkillDetailView-ChspOaAw.js +3 -0
  32. package/dist/assets/{SpecsView-DUx1sgtH.js → SpecsView-Cl4vpAoL.js} +1 -1
  33. package/dist/assets/{TechStackView-CvUiAISX.js → TechStackView-DsFV85XT.js} +1 -1
  34. package/dist/assets/{TerminalPanel-Dg5hqYTA.js → TerminalPanel-GraS3zw1.js} +1 -1
  35. package/dist/assets/{Toaster-BgN2bRJx.js → Toaster-D76T-Ld4.js} +1 -1
  36. package/dist/assets/{button-Dcy288Mc.js → button-ELs5xgtQ.js} +1 -1
  37. package/dist/assets/{chat-store-DbxFVDwi.js → chat-store-CBJ1gc8n.js} +1 -1
  38. package/dist/assets/{codemap-activity-store-DQfjo7-j.js → codemap-activity-store-D67-genN.js} +1 -1
  39. package/dist/assets/codemap-index-store-ByAYIzQA.js +1 -0
  40. package/dist/assets/{dialog-ftgTihmF.js → dialog-CfAoIH8P.js} +1 -1
  41. package/dist/assets/{empty-state-RRSqQaCk.js → empty-state-BDwjdvMh.js} +1 -1
  42. package/dist/assets/{i18n-9T7iGYgW.js → i18n-BvFgJYE2.js} +2 -2
  43. package/dist/assets/index-BTRQG7C5.js +132 -0
  44. package/dist/assets/index-DHsJniTZ.css +1 -0
  45. package/dist/assets/{input-fo9-BPBC.js → input-DSTQkMEh.js} +1 -1
  46. package/dist/assets/{mailbox-store-C1mzoSqJ.js → mailbox-store-CKpkM0H1.js} +1 -1
  47. package/dist/assets/{roster-ws-Da57e_sI.js → roster-ws-a3-SO1Yb.js} +1 -1
  48. package/dist/assets/{session-store-Df7_hhe9.js → session-store-Ce4Dck2K.js} +1 -1
  49. package/dist/assets/settings-BUtmAZBV.js +1 -0
  50. package/dist/assets/settings-BlMNd_AC.js +1 -0
  51. package/dist/assets/settings-ClpzPWKE.js +1 -0
  52. package/dist/assets/settings-CyYYbmdR.js +1 -0
  53. package/dist/assets/settings-DyIEVRJT.js +1 -0
  54. package/dist/assets/settings-Orwkg3lH.js +1 -0
  55. package/dist/assets/settings-XRC0dC9D.js +1 -0
  56. package/dist/assets/{shared-KAzksK0C.js → shared-D368RBth.js} +1 -1
  57. package/dist/assets/stores-BATHCuMN.js +7 -0
  58. package/dist/assets/{ui-store-CE4-TlwB.js → ui-store-BGNdg1e4.js} +1 -1
  59. package/dist/assets/{useWebSocket-CZSpbA3M.js → useWebSocket-B2opfRwA.js} +3 -3
  60. package/dist/assets/utils-CUCQrODG.js +1 -0
  61. package/dist/assets/{vendor-BuarzSSb.js → vendor-GiKfK4Iw.js} +30 -30
  62. package/dist/assets/{view-navigation-DIDEcp4V.js → view-navigation-FdnvQSOv.js} +1 -1
  63. package/dist/assets/{ws-client-TTMa0XaT.js → ws-client-CGEB75Dy.js} +1 -1
  64. package/dist/components/KanbanContractGraphDashboard.d.ts +7 -0
  65. package/dist/components/KanbanContractGraphPanel.d.ts +7 -0
  66. package/dist/components/KanbanContractGraphView.d.ts +40 -0
  67. package/dist/components/KanbanViewModeTabs.d.ts +1 -1
  68. package/dist/components/KanbanWorkbench.d.ts +9 -0
  69. package/dist/components/TaskVerificationSection.d.ts +3 -3
  70. package/dist/components/agent-roster-data.d.ts +9 -0
  71. package/dist/index.html +22 -22
  72. package/dist/index.js +5260 -3984
  73. package/dist/lib/palettes.d.ts +1 -1
  74. package/dist/stores/kanban-store.d.ts +2 -1
  75. package/dist/stores/session-store.d.ts +2 -0
  76. package/dist/types/sage.d.ts +5 -13
  77. package/dist/types/system.d.ts +2 -0
  78. package/package.json +8 -8
  79. package/dist/assets/AgentRosterView-BwukmHoA.js +0 -9
  80. package/dist/assets/ChronicleDashboard-BYGV5twz.js +0 -1
  81. package/dist/assets/CodeEditor-D2Dnax7e.js +0 -1
  82. package/dist/assets/CodeMap-DIKKs3Ux.js +0 -1
  83. package/dist/assets/GoalView-3291Hxnb.js +0 -1
  84. package/dist/assets/KanbanView-CFE63A4a.js +0 -3
  85. package/dist/assets/MailboxDetailView-CUTWkSyK.js +0 -1
  86. package/dist/assets/MemoryDrawer-Dsy0AX6f.js +0 -1
  87. package/dist/assets/MemoryManager-D1kXeVE3.js +0 -1
  88. package/dist/assets/OfficeMapPanel-Q81eioDB.js +0 -4
  89. package/dist/assets/SageTabs-olgLJfg_.js +0 -2
  90. package/dist/assets/SddHub-7Z55QY-M.js +0 -2
  91. package/dist/assets/SessionList-C3ygQN8A.js +0 -1
  92. package/dist/assets/SetupScreen-BkVjdky4.js +0 -1
  93. package/dist/assets/SkillDetailView-Cp-xEHww.js +0 -3
  94. package/dist/assets/codemap-index-store-COStDU-8.js +0 -1
  95. package/dist/assets/index-Cw20Xg0d.css +0 -1
  96. package/dist/assets/index-FHt-sKVF.js +0 -132
  97. package/dist/assets/progress-ring-B9pqitSa.js +0 -1
  98. package/dist/assets/settings-Bb7_utQE.js +0 -1
  99. package/dist/assets/settings-Bd8zMwvC.js +0 -1
  100. package/dist/assets/settings-DdFgBMAw.js +0 -1
  101. package/dist/assets/settings-De6sXIFO.js +0 -1
  102. package/dist/assets/settings-E8SKMLxq.js +0 -1
  103. package/dist/assets/settings-zIY9-ivF.js +0 -1
  104. package/dist/assets/settings-zKBcRjqE.js +0 -1
  105. package/dist/assets/stores-vuG0AaKy.js +0 -7
  106. package/dist/assets/utils-B-9lSDIn.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-CL5AiyKr.js","assets/rolldown-runtime-QTnfLwEv.js","assets/vendor-GiKfK4Iw.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css","assets/i18n-BvFgJYE2.js","assets/activity-BwEBEQ51.js","assets/chat-CdiY7G6Z.js","assets/commandPalette-DpaemFux.js","assets/common-COVxQ0FV.js","assets/settings-BUtmAZBV.js","assets/setup-BFcmn89w.js","assets/toasts-BL_8kH4B.js","assets/useWebSocket-B2opfRwA.js","assets/chat-store-CBJ1gc8n.js","assets/utils-CUCQrODG.js","assets/ws-client-CGEB75Dy.js","assets/session-store-Ce4Dck2K.js","assets/codemap-activity-store-D67-genN.js","assets/stores-BATHCuMN.js","assets/mailbox-store-CKpkM0H1.js","assets/ui-store-BGNdg1e4.js","assets/view-navigation-FdnvQSOv.js","assets/codemap-index-store-ByAYIzQA.js","assets/Toaster-D76T-Ld4.js","assets/dialog-CfAoIH8P.js","assets/button-ELs5xgtQ.js","assets/input-DSTQkMEh.js","assets/index-BTRQG7C5.js","assets/ConfirmModal-DXy17_uy.js","assets/ModelPicker-BazB-GbH.js","assets/index-DHsJniTZ.css","assets/roster-ws-a3-SO1Yb.js","assets/shared-D368RBth.js","assets/MemoryDrawer-D2Yq9oba.js","assets/AudienceMemoryPanel-BRXM47H1.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Fa as n,bt as r,lt as i,ur as a}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{s as o}from"./monaco-BLUV5g0U.js";import{t as s}from"./utils-CUCQrODG.js";import{C as c,E as l,T as u,w as d}from"./index-BTRQG7C5.js";var f=e(t(),1),p=i(),m=(0,f.lazy)(()=>o(()=>import(`./MemoryManager-CL5AiyKr.js`).then(e=>({default:e.MemoryManager})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),h=(0,f.lazy)(()=>o(()=>import(`./AudienceMemoryPanel-BRXM47H1.js`).then(e=>({default:e.AudienceMemoryPanel})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35])));function g({label:e}){return(0,p.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background text-xs text-muted-foreground`,"aria-busy":`true`,children:(0,p.jsxs)(`span`,{className:`font-mono uppercase tracking-wide`,children:[e,`…`]})})}var _=[{value:`all`,label:`activity:memoryManager.tabAllMemories`,hint:`activity:memoryManager.tabAllMemoriesHint`,Icon:a},{value:`audience`,label:`activity:memoryManager.tabAudience`,hint:`activity:memoryManager.tabAudienceHint`,Icon:r}];function v({defaultValue:e=`all`}={}){let{t}=n();return(0,p.jsxs)(c,{defaultValue:e,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,children:[(0,p.jsx)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-border/70 bg-card/55 px-4 py-2 sm:px-5`,role:`presentation`,children:(0,p.jsx)(u,{"aria-label":t(`activity:memoryManager.lensesAria`),className:`h-9 bg-muted/40 p-1 shadow-none`,children:_.map(({value:e,label:n,hint:r,Icon:i})=>(0,p.jsxs)(l,{value:e,className:s(`h-7 gap-2 px-3 text-[11px] font-semibold uppercase tracking-wide`,`data-[state=active]:bg-background data-[state=active]:text-foreground`,`data-[state=active]:shadow-[0_0_0_1px_hsl(var(--border)/0.7)]`),children:[(0,p.jsx)(i,{className:`size-3.5`}),(0,p.jsx)(`span`,{children:t(n)}),(0,p.jsx)(`span`,{className:`hidden font-mono text-[9px] font-normal normal-case text-muted-foreground sm:inline`,children:t(r)})]},e))})}),(0,p.jsx)(d,{value:`all`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(g,{label:t(`activity:memoryManager.loadingSage`)}),children:(0,p.jsx)(m,{})})}),(0,p.jsx)(d,{value:`audience`,className:`mt-0 flex-1 overflow-hidden ring-offset-0 focus-visible:ring-0`,children:(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(g,{label:t(`activity:memoryManager.loadingAudience`)}),children:(0,p.jsx)(h,{})})})]})}export{v as SageTabs};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Fa as n,Mr as r,Ot as i,Pr as a,Qt as o,Tn as s,Ut as c,Wi as l,_ as u,_r as d,a as f,ar as p,c as m,dt as h,ea as g,f as _,h as v,ha as y,i as b,lt as x,mn as S,oa as C,r as w,s as T,u as E}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as D}from"./utils-CUCQrODG.js";var O=e(t(),1),k=x();function A({pct:e}){let{t}=n(),r=(0,O.useId)(),i=2*Math.PI*26,a=i-Math.max(0,Math.min(100,e))/100*i;return(0,k.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,k.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":t(`activity:progressring.progress`),children:[(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#${r})`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:i,strokeDashoffset:a,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,k.jsx)(`defs`,{children:(0,k.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,k.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,k.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,k.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}var j={pending:{label:`Pending`,icon:l,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:l,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:p,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:l,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:l,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:h,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:g,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:y,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function M(e){return j[e]??j.pending}var N={critical:{text:`text-destructive`,chip:`bg-destructive/10 text-destructive`},high:{text:`text-warning`,chip:`bg-warning/12 text-warning`},medium:{text:`text-primary`,chip:`bg-primary/10 text-primary`},low:{text:`text-muted-foreground`,chip:`bg-muted text-muted-foreground`}};function P(e){return N[e]??N.medium}var F={running:`border-primary/35 bg-primary/10 text-primary`,paused:`border-warning/35 bg-warning/10 text-warning`,stopped:`border-border/70 bg-muted text-muted-foreground`,completed:`border-success/35 bg-success/10 text-success`,failed:`border-destructive/35 bg-destructive/10 text-destructive`,deadlocked:`border-destructive/35 bg-destructive/10 text-destructive`,idle:`border-border bg-muted text-muted-foreground`},I=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],L={started:{icon:s,color:`text-warning`},completed:{icon:g,color:`text-success`},failed:{icon:h,color:`text-destructive`},retrying:{icon:S,color:`text-warning`},wave:{icon:d,color:`text-primary`},deadlock:{icon:i,color:`text-destructive`},verification_failed:{icon:o,color:`text-destructive`},conflict:{icon:r,color:`text-warning`},split:{icon:c,color:`text-primary`},supervisor:{icon:C,color:`text-primary`}};function R(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function z(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?t%60?`${n}m ${t%60}s`:`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function B(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}var V=300,H=128,U=240,W={pending:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`},queued:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},in_progress:{ring:`border-warning/45`,chip:`bg-warning/12 text-warning`,dot:`bg-warning`},blocked:{ring:`border-destructive/30`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},review:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},failed:{ring:`border-destructive/45`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},completed:{ring:`border-success/35`,chip:`bg-success/12 text-success`,dot:`bg-success`},cancelled:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`}};function G({data:e}){let t=e.task,{t:r}=n(),i=W[t.displayStatus],o=t.displayStatus===`in_progress`,s=t.displayStatus===`completed`?g:t.displayStatus===`failed`?h:o?p:l;return(0,k.jsxs)(`div`,{className:D(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,i.ring,o&&`sdd-node-running`,t.displayStatus===`completed`&&`sdd-node-complete`,t.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:U,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,k.jsx)(`button`,{type:`button`,"aria-label":r(`activity:sdd.openTask`,{title:t.title,defaultValue:`Open task: ${t.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(t.id)}),(0,k.jsx)(T,{type:`target`,position:u.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsx)(T,{type:`source`,position:u.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(s,{className:D(`h-3.5 w-3.5`,o&&`animate-spin`,i.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,k.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:t.shortId}),(0,k.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,P(t.priority).text),children:t.priority[0]}),(0,k.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,i.chip),children:r(`activity:sdd.status.${t.displayStatus}`)})]}),(0,k.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:t.title}),(t.agentName||t.worktreeBranch)&&(0,k.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[t.agentName&&(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,k.jsx)(`span`,{className:D(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,o?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:R(t.agentName)}),(0,k.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:t.agentName})]}),t.retries?(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,k.jsx)(S,{className:`h-2.5 w-2.5`}),t.retries]}):null,t.worktreeBranch&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:t.worktreeBranch,children:[(0,k.jsx)(a,{className:`h-2.5 w-2.5`}),(0,k.jsx)(`span`,{className:`max-w-[70px] truncate`,children:t.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function K({data:e}){return(0,k.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var q={task:G,colLabel:K};function J(e,t,n){let r=new Map(e.map(e=>[e.shortId,e])),i=[],a=0;t.forEach((e,t)=>{i.push({id:`__col_${t}`,position:{x:t*V,y:-52},data:{label:e.label},draggable:!1,selectable:!1,type:`colLabel`,style:{pointerEvents:`none`}}),e.taskIds.forEach((e,o)=>{let s=r.get(e);s&&i.push({id:s.id,position:{x:t*V,y:o*H},data:{task:s,index:a++,onTaskClick:n},type:`task`,draggable:!0})})});let o=[];for(let t of e)for(let e of t.deps){let n=r.get(e);if(!n)continue;let i=n.displayStatus===`completed`&&(t.displayStatus===`in_progress`||t.displayStatus===`queued`);o.push({id:`${n.id}->${t.id}`,source:n.id,target:t.id,animated:i,className:i?`sdd-edge-flow`:void 0,style:{stroke:M(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function Y({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=v(),{nodes:i,edges:a}=(0,O.useMemo)(()=>J(e,t,n),[e,t,n]),o=e.length;return(0,O.useEffect)(()=>{let e=setTimeout(()=>r({padding:.18,duration:400}),60);return()=>clearTimeout(e)},[o,r]),(0,k.jsxs)(_,{nodes:i,edges:a,nodeTypes:q,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,k.jsx)(w,{variant:b.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,k.jsx)(f,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,k.jsx)(m,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?M(t).hex:`hsl(var(--muted-foreground))`},className:`!bottom-2 !right-2 !h-24 !w-40 overflow-hidden rounded-md border border-border/70 bg-card`})]})}function X({tasks:e,columns:t,onTaskClick:n}){return(0,k.jsx)(E,{children:(0,k.jsx)(Y,{tasks:e,columns:t,onTaskClick:n})})}export{R as a,P as c,F as i,M as l,I as n,B as o,L as r,z as s,X as t,A as u};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,An as n,Ba as r,Bn as i,Bt as a,Ct as o,Et as s,Fa as c,Gi as l,Gt as u,Kn as d,Li as f,Nt as p,Ot as ee,Pr as m,Pt as h,Qn as g,Ra as _,Sa as v,Tn as te,Ut as ne,Wt as y,Zi as b,Zr as x,ar as S,dt as C,ea as w,hn as T,in as re,ji as ie,jt as E,ka as D,lt as O,mi as ae,mn as k,ua as A,ut as j,xi as oe,xt as M}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as N}from"./useWebSocket-B2opfRwA.js";import{t as P}from"./utils-CUCQrODG.js";import{c as F,p as I,s as L}from"./stores-BATHCuMN.js";import{n as R}from"./ui-store-BGNdg1e4.js";import{o as z}from"./view-navigation-FdnvQSOv.js";import{a as B,i as V,n as H,o as U,r as W,t as G}from"./dialog-CfAoIH8P.js";import{t as K}from"./button-ELs5xgtQ.js";import{n as se,t as ce}from"./ModelPicker-BazB-GbH.js";import{c as le,s as ue}from"./index-BTRQG7C5.js";import{a as q,c as J,i as de,l as Y,n as fe,o as pe,r as me,s as X,t as he,u as ge}from"./SddFlowGraph-DWphr6Tr.js";import{SpecsView as _e}from"./SpecsView-Cl4vpAoL.js";var Z=e(r(),1),Q=O();function ve({feed:e,now:t}){let{t:n}=c();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-semibold text-foreground`,children:[(0,Q.jsx)(D,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto overscroll-contain p-2`,children:e.length===0?(0,Q.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:n(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=me[e.kind]??me.started,i=r.icon;return(0,Q.jsxs)(`div`,{className:P(`sdd-rise flex items-start gap-2 rounded-md px-2 py-1.5 text-[11px]`,n===0?`bg-muted`:`hover:bg-muted`),children:[(0,Q.jsx)(i,{className:P(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,Q.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,Q.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:pe(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function ye({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:a}=c(),o=n?.mergedCommits?.length??0,s=n?.baseBranch,[l,u]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&u(!1)},[e]);let d=n?.status===`running`||n?.status===`paused`,f=(0,Z.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),p=(0,Z.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[n?.tasks]);return(0,Q.jsx)(G,{open:e,onOpenChange:e=>!r&&t(e),children:(0,Q.jsxs)(H,{className:`sm:max-w-lg border-destructive/50`,children:[(0,Q.jsxs)(B,{children:[(0,Q.jsxs)(U,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(E,{className:`h-5 w-5 text-destructive`}),a(`activity:sdd.destroyTitle`)]}),(0,Q.jsx)(W,{children:a(`activity:sdd.destroyDesc`)})]}),(0,Q.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[d&&(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:p>0?a(`activity:sdd.stopRunAgents`,{count:p}):a(`activity:sdd.stopRun`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:f>0?a(`activity:sdd.removeWorktreesCount`,{count:f}):a(`activity:sdd.removeWorktreesAll`)})]}),(0,Q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Q.jsx)(`span`,{children:a(`activity:sdd.deleteArtifacts`)})]})]}),o>0&&(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md border border-warning/30 bg-warning/5 p-2.5 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:a(`activity:sdd.revertMerged`,{count:o})}),` `,`on `,(0,Q.jsx)(`code`,{className:`text-xs`,children:s??a(`activity:sdd.baseBranchFallback`)}),(0,Q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(`activity:sdd.revertHint`)})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ee,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(o>0&&!l?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,Q.jsxs)(V,{className:`gap-2 sm:gap-2`,children:[(0,Q.jsx)(K,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:a(`common:action.cancel`)}),(0,Q.jsx)(K,{size:`sm`,disabled:r,onClick:()=>i(l),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,a(`activity:sdd.destroying`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E,{className:`mr-1 h-3.5 w-3.5`}),` `,a(`activity:sdd.destroyAll`)]})})]})]})})}var be=[{key:`pending`,labelKey:`kanbanBacklog`,accent:`border-border/70`,head:`text-muted-foreground`},{key:`queued`,labelKey:`kanbanReady`,accent:`border-primary/35`,head:`text-primary`},{key:`in_progress`,labelKey:`kanbanRunning`,accent:`border-warning/45`,head:`text-warning`},{key:`review`,labelKey:`kanbanReview`,accent:`border-primary/35`,head:`text-primary`},{key:`failed`,labelKey:`kanbanFailed`,accent:`border-destructive/35`,head:`text-destructive`},{key:`completed`,labelKey:`kanbanDone`,accent:`border-success/35`,head:`text-success`}];function xe({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=c(),i=(0,Z.useMemo)(()=>{let t=new Map;for(let e of be)t.set(e.key,[]);for(let n of e){let e=n.displayStatus===`blocked`?`pending`:n.displayStatus===`cancelled`?`failed`:n.displayStatus;(t.get(e)??t.get(`pending`))?.push(n)}return t},[e]);return(0,Q.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:be.map(e=>{let a=i.get(e.key)??[];return(0,Q.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:P(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,Q.jsx)(`span`,{className:P(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[a.map(e=>(0,Q.jsx)(Se,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,Q.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:r(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function Se({task:e,selected:t,onClick:n}){let r=e.displayStatus===`in_progress`;return(0,Q.jsxs)(`button`,{type:`button`,onClick:n,className:P(`sdd-node-enter w-full rounded-lg border bg-card/85 p-2 text-left shadow-sm transition hover:border-primary/35 hover:bg-accent/35`,t?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,r&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,Q.jsx)(S,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,Q.jsx)(w,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,Q.jsx)(C,{className:`h-3 w-3 text-destructive`}),(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,Q.jsx)(`span`,{className:P(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,J(e.priority).chip),children:e.priority})]}),(0,Q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,Q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:P(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,r?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:q(e.agentName)}),(0,Q.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,Q.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,Q.jsx)(k,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,Q.jsx)(m,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function Ce({task:e,allTasks:t,feed:n,now:r,expanded:i,modelCandidates:s,defaultModel:l,onClose:u,onToggleExpanded:f,onRetry:p,onReassign:ee,onSetModel:h,onSetVerification:_,onCancel:te,onDelete:y,onSplit:b,onSelectTask:x}){let{t:S}=c(),T=Y(e.displayStatus),re=T.icon,D=e.displayStatus===`in_progress`,O=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[ae,A]=(0,Z.useState)(!1),[j,oe]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(null),[F,I]=(0,Z.useState)(!1),[L,R]=(0,Z.useState)(``),[z,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(e.verificationCommand??``),U=()=>{j.trim()&&(ee(e.id,j.trim()),A(!1),oe(``))},W=()=>{let t=L.split(`
2
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`::`),r=(t??``).trim();return{title:r,description:n.join(`::`).trim()||r}}).filter(e=>e.title);t.length&&(b(e.id,t),I(!1),R(``))},G=(0,Z.useMemo)(()=>new Map(t.map(e=>[e.shortId,e])),[t]),K=(0,Z.useMemo)(()=>t.filter(t=>t.deps.includes(e.shortId)),[t,e.shortId]),se=(0,Z.useMemo)(()=>n.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[n,e.id,e.shortId]),le=e.startedAt&&!e.completedAt?X(r-e.startedAt):e.startedAt&&e.completedAt?X(e.completedAt-e.startedAt):null;return(0,Q.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:P(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,i&&`px-5 py-3`),children:[(0,Q.jsx)(`button`,{type:`button`,onClick:u,className:`text-muted-foreground hover:text-foreground`,title:S(`activity:sddTask.backTitle`),children:(0,Q.jsx)(v,{className:`h-4 w-4`})}),(0,Q.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),f&&(0,Q.jsx)(`button`,{type:`button`,onClick:f,className:`ml-1 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground`,title:S(i?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":S(i?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":i,children:i?(0,Q.jsx)(d,{className:`h-4 w-4`}):(0,Q.jsx)(g,{className:`h-4 w-4`})}),(0,Q.jsxs)(`span`,{className:P(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,T.ring,T.text),children:[(0,Q.jsx)(re,{className:P(`h-3 w-3`,D&&`animate-spin`)}),T.label]})]}),(0,Q.jsxs)(`div`,{className:P(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,i?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,Q.jsx)(`h3`,{className:P(`text-sm font-semibold leading-snug text-foreground`,i&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,Q.jsx)(`span`,{className:P(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,D?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:q(e.agentName)}),(0,Q.jsxs)(`div`,{className:`leading-tight`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,Q.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:S(D?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,Q.jsx)(Te,{label:S(`activity:sddTask.metaPriority`),children:(0,Q.jsx)(`span`,{className:P(`font-medium uppercase`,J(e.priority).text),children:e.priority})}),(0,Q.jsx)(Te,{label:S(`activity:sddTask.metaType`),children:e.type}),le&&(0,Q.jsx)(Te,{label:e.completedAt?S(`activity:sddTask.metaDuration`):S(`activity:sddTask.metaElapsed`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(ie,{className:`h-3 w-3 text-muted-foreground`}),le]})}),e.retries?(0,Q.jsx)(Te,{label:S(`activity:sddTask.metaRetries`),children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,Q.jsx)(k,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,Q.jsx)(Te,{label:S(`activity:sddTask.metaWorktree`),full:!0,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,Q.jsx)(m,{className:`h-3 w-3 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[S(`activity:sddTask.workerModel`),!e.model&&l&&(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,S(`activity:sddTask.runDefault`,{model:l})]})]}),(0,Q.jsx)(ce,{value:e.model,provider:e.provider,candidates:s,placeholder:l?S(`activity:sddTask.runDefaultPlaceholderModel`,{model:l}):S(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>h(e.id,t,n),onReset:e.model?()=>h(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,Q.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[S(`activity:sddTask.verificationCmd`),(0,Q.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,S(`activity:sddTask.gatesCompletion`)]})]}),z?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`input`,{value:V,onChange:e=>H(e.target.value),onKeyDown:t=>{t.key===`Enter`?(_(e.id,V.trim()||void 0),B(!1)):t.key===`Escape`&&(H(e.verificationCommand??``),B(!1))},placeholder:S(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{_(e.id,V.trim()||void 0),B(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:S(`common:action.save`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{H(e.verificationCommand??``),B(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:S(`common:action.cancel`)})]})]}):e.verificationCommand?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,Q.jsx)(`span`,{title:e.verificationDetail,className:e.verificationState===`passed`?`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`:`rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] text-destructive`,children:e.verificationState===`passed`?`✓ verified`:`✗ failed`}),(0,Q.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e.verificationCommand}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:S(`common:action.edit`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>_(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:S(`common:action.clear`)})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:S(`activity:sddTask.addVerify`)})]}),e.description&&(0,Q.jsxs)(`div`,{className:P(i&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:S(`activity:sddTask.description`)}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,Q.jsx)(we,{events:se,expanded:i}),e.deps.length>0&&(0,Q.jsx)(Ee,{title:S(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:G,onSelectTask:x}),K.length>0&&(0,Q.jsx)(Ee,{title:S(`activity:sddTask.blocks`),shortIds:K.map(e=>e.shortId),byShort:G,onSelectTask:x})]}),(0,Q.jsxs)(`div`,{className:P(`border-t border-border p-2`,i&&`px-5 py-3`),children:[ae?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,Q.jsx)(`input`,{value:j,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key===`Enter`&&U(),e.key===`Escape`&&A(!1)},placeholder:S(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,Q.jsx)(`button`,{type:`button`,onClick:U,disabled:!j.trim(),className:`rounded-md bg-primary/10 px-2 py-1.5 text-xs font-medium text-primary hover:bg-primary/15 disabled:opacity-40`,children:(0,Q.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>A(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(C,{className:`h-3.5 w-3.5`})})]}):M?(0,Q.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:S(M===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{M===`stop`?te(e.id):y(e.id),N(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(w,{className:`h-3.5 w-3.5`}),` `,S(M===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>N(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(C,{className:`h-3.5 w-3.5`})})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),title:S(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,S(`common:action.retry`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>A(!0),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(o,{className:`h-3.5 w-3.5`}),` `,S(`activity:sddTask.reassign`)]}),D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>N(`stop`),title:S(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(a,{className:`h-3.5 w-3.5`}),` `,S(`common:action.stop`)]}),!D&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>I(!0),title:S(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,S(`activity:sddTask.split`)]}),O&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>N(`delete`),title:S(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Q.jsx)(E,{className:`h-3.5 w-3.5`}),` `,S(`common:action.delete`)]})]}),F&&(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,Q.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:S(`activity:sddTask.splitHint`)}),(0,Q.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:L,onChange:e=>R(e.target.value),placeholder:S(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:W,className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Q.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,S(`activity:sddTask.splitInto`)]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{I(!1),R(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(C,{className:`h-3.5 w-3.5`})})]})]})]})]})}function we({events:e,expanded:t}){let{t:n}=c();return(0,Q.jsxs)(`section`,{className:P(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,Q.jsx)(D,{className:`h-4 w-4 text-primary`}),(0,Q.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`activity:sddTask.eventLog`)}),(0,Q.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,Q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:n(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:n(`activity:sddTask.noEvents`)}):(0,Q.jsx)(`div`,{className:P(`divide-y divide-border/45 overflow-auto`,t?`max-h-[32rem]`:`max-h-72`),children:e.map((e,t)=>{let n=e.kind===`file`,r=e.kind===`tool`,i=e.ok===!1||e.kind===`failed`||e.kind===`verification_failed`,a=n?x:r?p:D;return(0,Q.jsxs)(`div`,{className:P(`grid grid-cols-[4.75rem_1rem_minmax(0,1fr)] gap-2 px-3 py-2.5 text-[11px]`,i&&`bg-destructive/[0.035]`),children:[(0,Q.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`font-mono text-[10px] text-muted-foreground`,title:new Date(e.ts).toLocaleString(),children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(a,{className:P(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,Q.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-foreground`,children:e.action}),e.agentName&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,Q.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.durationMs<1e3?`${Math.round(e.durationMs)}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]}),e.filePath?(0,Q.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,Q.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,Q.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function Te({label:e,children:t,full:n}){return(0,Q.jsxs)(`div`,{className:P(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,Q.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`text-foreground`,children:t})]})}function Ee({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,Q.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-foreground hover:bg-muted disabled:opacity-50`,title:t?.title,children:[(0,Q.jsx)(`span`,{className:P(`h-1.5 w-1.5 rounded-full`,Y(t?.displayStatus??`pending`).dot)}),(0,Q.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function De({onClose:e}){let{t}=c(),{client:r}=N(),i=F(e=>e.snapshot),o=F(e=>e.lifecycleResult),l=F(e=>e.destroying),u=F(e=>e.setDestroying),d=F(e=>e.setLifecycleResult),[f,p]=(0,Z.useState)(()=>Date.now()),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(!1),[v,ne]=(0,Z.useState)(`graph`),[y,b]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{r?.send?.({type:`sdd.board.get`})},[r]);let x=i&&(i.status===`running`||i.status===`paused`);(0,Z.useEffect)(()=>{if(!x)return;let e=setInterval(()=>p(Date.now()),1e3);return p(Date.now()),()=>clearInterval(e)},[x]);let S=(0,Z.useCallback)(e=>r?.send?.(e),[r]),w=(0,Z.useRef)(null),T=(0,Z.useCallback)(e=>{w.current=null,S({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[S]),re=(0,Z.useCallback)(e=>{b(!1),d(null),u(!0),x?(S({type:`sdd.board.stop`,payload:{}}),w.current={revertMerged:e,deadline:Date.now()+2e4}):T(e)},[x,S,T,u,d]);(0,Z.useEffect)(()=>{let e=w.current;if(!e)return;if(!x||Date.now()>=e.deadline){T(e.revertMerged);return}let t=setTimeout(()=>{let e=w.current;e&&T(e.revertMerged)},Math.max(0,e.deadline-Date.now()));return()=>clearTimeout(t)},[x,i,T]);let ie=(0,Z.useCallback)(()=>{d(null),S({type:`sdd.board.cleanup_worktrees`,payload:{}})},[S,d]),O=(0,Z.useCallback)(()=>{d(null),S({type:`sdd.board.rollback`,payload:{}})},[S,d]),A=(0,Z.useMemo)(()=>(i?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch})),[i?.tasks]),M=(0,Z.useMemo)(()=>{let e=new Map;for(let t of i?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[i?.tasks]),L=(0,Z.useCallback)(e=>h(e),[]),z=(0,Z.useCallback)(()=>{h(null),_(!1)},[]),B=(0,Z.useCallback)(e=>S({type:`sdd.board.retry`,payload:{taskId:e}}),[S]),V=(0,Z.useCallback)(()=>S({type:`sdd.board.retry_all_failed`,payload:{}}),[S]),H=(0,Z.useCallback)((e,t)=>{let n=t.trim();n&&S({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[S]),U=(0,Z.useCallback)((e,t,n)=>S({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[S]),W=(0,Z.useCallback)((e,t)=>S({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[S]),G=(0,Z.useCallback)(e=>S({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[S]),ce=(0,Z.useCallback)(e=>{S({type:`sdd.board.delete_task`,payload:{taskId:e}}),h(null),_(!1)},[S]),le=(0,Z.useCallback)((e,t)=>{S({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),h(null),_(!1)},[S]),ue=se(m!==null),J=(0,Z.useMemo)(()=>i?.tasks.find(e=>e.id===m)??null,[i?.tasks,m]),Y=i?.progress,pe=i?.diagnostics?.deadlockChains??[];return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(D,{className:`h-5 w-5 text-warning`}),(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:i?.title??t(`activity:sddBoard.titleFallback`)}),i&&(0,Q.jsx)(`span`,{className:P(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,de[i.status]??de.idle),children:i.status}),i?.defaultModel&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,title:t(`activity:sddBoard.defaultModelTitle`),children:[(0,Q.jsx)(oe,{className:`h-3 w-3 text-primary`}),i.defaultModel]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,Q.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${i.runId}`,t=I.getState().boards.filter(t=>t.tags?.includes(e)),n=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];n&&(I.getState().setActiveBoardId(n.id),r?.send?.({type:`kanban.get`,payload:{boardId:n.id}})),R.getState().setCurrentView(`kanban`)},className:`inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Q.jsx)(D,{className:`h-3.5 w-3.5`}),` Kanban`]}),i&&(0,Q.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>ne(e),className:P(`rounded px-2 py-0.5 capitalize transition`,v===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),x&&(Y?.failed??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:V,title:t(`activity:sddBoard.retryAllTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:Y?.failed??0})]}),x&&(0,Q.jsxs)(Q.Fragment,{children:[i?.status===`paused`?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>S({type:`sdd.board.resume`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Q.jsx)(te,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>S({type:`sdd.board.pause`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(n,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>S({type:`sdd.board.stop`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive hover:bg-destructive/25`,children:[(0,Q.jsx)(a,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),i&&!x&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:ie,title:t(`activity:sddBoard.cleanTitle`),className:`inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[(0,Q.jsx)(ae,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(i.mergedCommits?.length??0)>0&&(0,Q.jsxs)(`button`,{type:`button`,onClick:O,title:t(`activity:sddBoard.rollbackTitle`,{count:i.mergedCommits?.length??0,base:i.baseBranch??t(`activity:sdd.baseBranchFallback`)}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Q.jsx)(s,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:i.mergedCommits?.length??0})]})]}),i&&(l?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive`,children:[(0,Q.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(x?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>b(!0),title:t(`activity:sddBoard.destroyTitle`),className:`inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1 text-xs font-medium text-destructive-foreground hover:bg-destructive/90`,children:[(0,Q.jsx)(E,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(C,{className:`h-4 w-4`})})]})]}),i&&Y&&(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,Q.jsx)(ge,{pct:Y.percentComplete}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Q.jsx)(Ae,{label:t(`activity:sddBoard.statDone`),value:`${Y.completed}/${Y.total}`,color:`text-success`}),Y.inProgress>0&&(0,Q.jsx)(Ae,{label:t(`activity:sddBoard.statRunning`),value:Y.inProgress,color:`text-warning`}),Y.failed>0&&(0,Q.jsx)(Ae,{label:t(`activity:sddBoard.statFailed`),value:Y.failed,color:`text-destructive`}),(0,Q.jsx)(Ae,{label:t(`activity:sddBoard.statWave`),value:i.wave+1,color:`text-primary`}),x&&i.startedAt>0&&(0,Q.jsx)(Ae,{label:t(`activity:sddBoard.statElapsed`),value:X(f-i.startedAt),color:`text-foreground`})]}),(0,Q.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:M.length===0?(0,Q.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):M.map((e,t)=>(0,Q.jsxs)(`span`,{title:`${e.name} → ${e.task}`,className:`flex items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2`,children:[(0,Q.jsx)(`span`,{className:P(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,fe[t%fe.length]),children:q(e.name)}),(0,Q.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),o&&(0,Q.jsx)(ke,{result:o,onDismiss:()=>d(null)}),pe.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:[(0,Q.jsx)(ee,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),pe.map(e=>(0,Q.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:i?v===`graph`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(he,{tasks:A,columns:i.columns,onTaskClick:L}),(0,Q.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur`,children:t(`activity:sddBoard.clickTaskHint`)})]}):(0,Q.jsx)(xe,{tasks:i.tasks,selectedId:m,onTaskClick:L}):(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Q.jsx)(j,{className:`h-10 w-10 text-primary/40`}),(0,Q.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,Q.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),i&&(0,Q.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":g&&J?`true`:`false`,className:P(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,g&&J?`w-[min(72rem,72vw)]`:`w-80`),children:J?(0,Q.jsx)(Ce,{task:J,allTasks:i.tasks,feed:i.taskEvents?.[J.id]??i.feed??[],now:f,expanded:g,modelCandidates:ue,defaultModel:i.defaultModel,onClose:z,onToggleExpanded:()=>_(e=>!e),onRetry:B,onReassign:H,onSetModel:U,onSetVerification:W,onCancel:G,onDelete:ce,onSplit:le,onSelectTask:h},J.id):(0,Q.jsx)(ve,{feed:i.feed??[],now:f})})]}),(0,Q.jsx)(ye,{open:y,onOpenChange:b,snapshot:i,busy:l,onConfirm:re})]})}function Oe(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=_.t(`activity:sddBoard.${t}`);if(!e.ok)return _.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??_.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(_.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(_.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(_.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):_.t(`activity:sddBoard.lcNothing`);return e.reason?_.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):_.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function ke({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,Q.jsxs)(`div`,{className:P(`flex items-start gap-2 border-b px-4 py-2 text-xs`,n?`border-warning/30 bg-warning/5 text-warning`:`border-success/30 bg-success/5 text-success`),children:[n?(0,Q.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,Q.jsx)(l,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:Oe(e)}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,Q.jsx)(C,{className:`h-3.5 w-3.5`})})]})}function Ae({label:e,value:t,color:n}){return(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,Q.jsx)(`span`,{className:P(`font-semibold tabular-nums`,n),children:t}),(0,Q.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var je={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},Me=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Ne({onClose:e,onRunStarted:n}){let{t:r}=c(),{client:a}=N(),o=L(e=>e.snapshot),s=L(e=>e.agentText),l=L(e=>e.error),d=L(e=>e.startedRunId),f=L(e=>e.setStartedRunId),[p,ee]=(0,Z.useState)(``),[m,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(!0),[x,ie]=(0,Z.useState)(!0),[E,D]=(0,Z.useState)(!1),[O,ae]=(0,Z.useState)(void 0),[k,A]=(0,Z.useState)(void 0),[j,oe]=(0,Z.useState)([]),[M,F]=(0,Z.useState)(4),[I,R]=(0,Z.useState)(!0),[z,B]=(0,Z.useState)(!1),V=se(E),H=(0,Z.useCallback)(e=>a?.send?.(e),[a]),U=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{H({type:`sdd.spec.get`})},[H]),(0,Z.useEffect)(()=>{U.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[o?.answers.length??0,s]),(0,Z.useEffect)(()=>{d&&(f(null),n?.())},[n,f,d]);let W=o?.busy??!1,G=o?.phase??`idle`,q=!!o?.sessionId,de=!!o?.resumed,Y=o?.lastRunId;(0,Z.useEffect)(()=>{q&&v(!1)},[q]);let fe=o?.answers[o.answers.length-1]?.question??``,pe=!!o&&(o.taskCount>0||!!o.graphId||G===`task_review`||G===`executing`),me=()=>{let e=p.trim();!e||W||_||(v(!0),H({type:`sdd.spec.start`,payload:{goal:e}}))},X=()=>{let e=m.trim();!e||W||(H({type:`sdd.spec.message`,payload:{text:e}}),g(``))},ge=()=>!W&&H({type:`sdd.spec.approve`,payload:{}}),_e=()=>{H({type:`sdd.run.start`,payload:{parallelSlots:M,worktrees:I,planDecompose:z,...O?{model:O,provider:k}:{},...j.length?{fallbackModels:j}:{}}}),D(!1)},ve=()=>{W||H({type:`sdd.spec.discard`,payload:{}})},ye=(0,Z.useMemo)(()=>(o?.board?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch,retries:e.retries})),[o?.board]),be=ye.length>0;return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(y,{className:`h-5 w-5 text-primary`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:o?.title||r(`activity:sddWizard.titleFallback`)}),q&&(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`activity:sddWizard.${je[G]??`phaseStart`}`),G===`questioning`&&` · ${r(`activity:sddWizard.questionsSuffix`,{cur:o?.questionCount??0,max:o?.maxQuestions??0})}`,o&&o.taskCount>0?` · ${r(`activity:sddWizard.tasksSuffix`,{count:o.taskCount})}`:``]})]}),W&&(0,Q.jsx)(S,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Y&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n?.(),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.openLiveBoard`)]}),q&&(0,Q.jsx)(`button`,{type:`button`,onClick:ve,disabled:W,title:r(`activity:sddWizard.discardTitle`),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:opacity-50`,children:r(`activity:sddWizard.discardInterview`)}),pe&&(0,Q.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>D(e=>!e),title:r(`activity:sddWizard.runCfgTitle`),className:P(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,O||j.length||z?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,Q.jsx)(u,{className:`h-3.5 w-3.5`}),O||r(`activity:sddWizard.modelsLabel`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:_e,className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Q.jsx)(T,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.startRun`)]}),E&&(0,Q.jsxs)(`div`,{className:`sdd-rise absolute right-0 top-9 z-50 w-72 rounded-lg border border-border bg-popover p-3 shadow-xl`,children:[(0,Q.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.defaultWorkerModel`)}),(0,Q.jsx)(ce,{value:O,provider:k,candidates:V,placeholder:r(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:r(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{ae(e),A(t)},onReset:O?()=>{ae(void 0),A(void 0)}:void 0}),(0,Q.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.fallbackChain`)}),(0,Q.jsx)(ue,{value:j,candidates:V,onChange:oe}),(0,Q.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:r(`activity:sddWizard.appliesToAll`)}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.parallelAgents`)}),(0,Q.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:M,onChange:e=>{let t=Number.parseInt(e.target.value,10);F(Number.isFinite(t)?Math.min(16,Math.max(1,t)):1)},className:`w-16 rounded-md border border-border bg-background px-2 py-1 text-right text-xs outline-none focus:border-primary`})]}),(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.isolateWorktrees`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:I,onChange:e=>R(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(I?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.planDecompose`)}),(0,Q.jsx)(`input`,{type:`checkbox`,checked:z,onChange:e=>B(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(z?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,Q.jsx)(K,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Q.jsx)(C,{className:`h-4 w-4`})})]})]}),q&&(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:Me.map((e,t)=>{let n=e===G,i=Me.indexOf(G)>t;return(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsxs)(`span`,{className:P(`rounded-full px-2 py-0.5`,n?`bg-primary/15 text-primary`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,Q.jsx)(w,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${je[e]}`)]}),t<Me.length-1&&(0,Q.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,Q.jsxs)(`div`,{ref:le(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[l&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:l}),de&&q&&(0,Q.jsx)(`div`,{className:`mb-3 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-primary`,children:r(`activity:sddWizard.resumeBanner`)}),q?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[be&&(0,Q.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ne(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-muted/40`,children:[te?(0,Q.jsx)(t,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(b,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(i,{className:`h-3.5 w-3.5`}),r(`activity:sddWizard.taskGraphSummary`,{count:o?.taskCount??0}),(0,Q.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:r(te?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),te&&(0,Q.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,Q.jsx)(he,{tasks:ye,columns:o?.board?.columns??[]})})]}),(0,Q.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-3`,children:[o?.goal&&(0,Q.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,Q.jsx)(h,{className:`h-3 w-3`}),` `,r(`activity:sddWizard.goalLabel`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:o.goal})]}),o?.answers.length||s&&G===`questioning`||W?(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[o?.answers.map(e=>(0,Q.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Q.jsx)(Fe,{speaker:`assistant`,text:e.question}),(0,Q.jsx)(Fe,{speaker:`user`,text:e.answer})]},e.question.slice(0,64))),s&&G===`questioning`&&s!==fe&&(0,Q.jsx)(Fe,{speaker:`assistant`,text:s}),W&&(0,Q.jsx)(Fe,{speaker:`assistant`,text:``,thinking:!0})]}):null,o?.spec&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Q.jsx)(y,{className:`h-3.5 w-3.5 text-primary`}),o.spec.title]}),(0,Q.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.spec.overview}),(0,Q.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:o.spec.requirements.map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(`span`,{className:P(`shrink-0 font-mono uppercase`,J(e.priority).text),children:e.priority[0]}),(0,Q.jsx)(`span`,{children:e.description})]},`${e.priority}-${e.description.slice(0,32)}`))})]}),s&&(G===`implementation`||G===`task_review`)&&(0,Q.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>ie(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-2 text-sm font-semibold hover:bg-muted/40`,children:[x?(0,Q.jsx)(t,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(b,{className:`h-3.5 w-3.5`}),(0,Q.jsx)(y,{className:`h-3.5 w-3.5 text-primary`}),` `,r(`activity:sddWizard.implementationPlan`)]}),x&&(0,Q.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:Pe(s)})})]}),s&&G!==`questioning`&&G!==`implementation`&&G!==`task_review`&&!o?.spec&&(0,Q.jsx)(Fe,{speaker:`assistant`,text:s}),(G===`spec_review`||G===`implementation`||G===`task_review`)&&(0,Q.jsxs)(K,{variant:`secondary`,onClick:ge,disabled:W,children:[(0,Q.jsx)(w,{className:`mr-1.5 h-4 w-4`}),r(G===`spec_review`?`activity:sddWizard.approveSpec`:G===`task_review`?`activity:sddWizard.approveTasks`:`activity:sddWizard.approvePlan`)]}),(0,Q.jsx)(`div`,{ref:U})]})]}):(0,Q.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:r(`activity:sddWizard.goalPrompt`)}),(0,Q.jsx)(`textarea`,{id:`sdd-goal`,value:p,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&me()},rows:4,placeholder:r(`activity:sddWizard.goalPlaceholder`),className:`w-full resize-none rounded-md border border-border bg-card px-3 py-2 text-sm outline-none focus:border-primary`}),(0,Q.jsx)(K,{className:`mt-3`,onClick:me,disabled:!p.trim()||_,children:_?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,r(`activity:sddWizard.startingInterview`)]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{className:`mr-1.5 h-4 w-4`}),` `,r(`activity:sddWizard.startInterview`)]})}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:r(`activity:sddWizard.introBody`)})]})]}),q&&G!==`executing`&&G!==`done`&&(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 border-t bg-card px-4 py-2`,children:[(0,Q.jsx)(`textarea`,{value:m,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),X())},rows:1,placeholder:r(G===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:W,className:`max-h-32 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary disabled:opacity-50`}),(0,Q.jsx)(K,{size:`icon`,onClick:X,disabled:W||!m.trim(),children:(0,Q.jsx)(re,{className:`h-4 w-4`})})]})]})}function Pe(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Fe({speaker:e,text:t,live:n,thinking:r}){let i=e===`user`;return(0,Q.jsxs)(`div`,{className:P(`sdd-rise flex items-start gap-2`,i&&`flex-row-reverse`),children:[(0,Q.jsx)(`span`,{className:P(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full`,i?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:i?(0,Q.jsx)(M,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(A,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`div`,{className:P(`max-w-[80%] whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed text-foreground`,i?`rounded-tr-sm bg-info/10`:`rounded-tl-sm bg-muted`),children:r?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 py-0.5`,children:[(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,Q.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):t})]})}var $=[{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function Ie(){let{t:e}=c(),[t,n]=(0,Z.useState)(`project`),r=L(e=>e.startedRunId),i=L(e=>e.setStartedRunId),a=()=>z(`chat`),o=(0,Z.useCallback)(()=>n(`board`),[]);(0,Z.useEffect)(()=>{r&&(n(`board`),i(null))},[r,i]);let s=(e,t)=>{let r;if(e.key===`ArrowLeft`&&(r=(t-1+$.length)%$.length),e.key===`ArrowRight`&&(r=(t+1)%$.length),e.key===`Home`&&(r=0),e.key===`End`&&(r=$.length-1),r===void 0)return;e.preventDefault();let i=$[r];i&&(n(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[r]?.focus())};return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Q.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:$.map((r,i)=>{let a=t===r.id;return(0,Q.jsxs)(`button`,{id:`sdd-hub-tab-${r.id}`,type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sdd-hub-panel-${r.id}`,tabIndex:a?0:-1,onClick:()=>n(r.id),onKeyDown:e=>s(e,i),className:P(`relative px-4 py-2.5 text-sm font-medium transition-colors`,a?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e(r.labelKey),a&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},r.id)})}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{id:`sdd-hub-panel-project`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-project`,hidden:t!==`project`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ne,{onClose:a,onRunStarted:o})}),(0,Q.jsx)(`div`,{id:`sdd-hub-panel-board`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-board`,hidden:t!==`board`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(De,{onClose:a})}),(0,Q.jsx)(`div`,{id:`sdd-hub-panel-specs`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-specs`,hidden:t!==`specs`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(_e,{onClose:a,onRunStarted:o})})]})]})}export{Ie as SddHub};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Er as t,Ii as n,Na as r,Oa as i,Ot as a,Pa as o,Wi as s,Yn as c,an as l,bi as u,ft as d,ir as f,lt as p,na as m,oi as h,pn as g,xa as _,za as v}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as y}from"./useWebSocket-CZSpbA3M.js";import{t as b}from"./ws-client-TTMa0XaT.js";import{t as x}from"./utils-B-9lSDIn.js";import{I as S}from"./stores-vuG0AaKy.js";import{n as C}from"./ui-store-CE4-TlwB.js";import{i as w,n as T,r as E}from"./SessionList-C3ygQN8A.js";var D=e(v(),1),O=r(e=>({payload:null,loading:!1,error:null,setPayload:t=>e({payload:t,loading:!1,error:null}),setError:t=>e({error:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({payload:null,loading:!1,error:null})})),k=!1;function A(){if(k)return;let e=S.getState().wsUrl;e&&(b(e).on(`session.inspect`,e=>{let t=e.payload,n=O.getState();t?.error?n.setError(t.error):t&&n.setPayload(t)}),k=!0)}var j=p(),M={session_start:i,session_resumed:g,user_input:c,llm_request:u,llm_response:u,tool_use:d,tool_call_start:d,tool_call_end:d,tool_result:d,compaction:g,context_snapshot:t,error:n,session_end:s,message_appended:c,message_updated:c,messages_replaced:c,messages_dropped:c,file_event:h,mode_changed:i,task_created:i,task_updated:i,task_completed:s,task_failed:n,agent_spawned:i,agent_stopped:i,agent_error:n,provider_retry:g,provider_error:a};function N(e){switch(e){case`error`:case`task_failed`:case`agent_error`:return`text-destructive border-destructive/30 bg-destructive/5`;case`tool_call_end`:case`tool_use`:case`tool_call_start`:return`text-primary border-primary/30 bg-primary/5`;case`file_event`:return`text-success border-success/30 bg-success/5`;case`compaction`:return`text-warning border-warning/30 bg-warning/5`;case`user_input`:return`text-foreground border-border`;default:return`text-muted-foreground border-border`}}function P(e,t){switch(e){case`completed`:return{label:t(`activity:sessionInspect.outcomeCompleted`),cls:`border-success/30 bg-success/10 text-success`};case`error`:return{label:t(`activity:sessionInspect.outcomeError`),cls:`border-destructive/30 bg-destructive/10 text-destructive`};case`timeout`:return{label:t(`activity:sessionInspect.outcomeTimeout`),cls:`border-warning/30 bg-warning/10 text-warning`};case`aborted`:return{label:t(`activity:sessionInspect.outcomeAborted`),cls:`border-muted-foreground/30 bg-muted text-muted-foreground`};default:return{label:t(`activity:sessionInspect.outcomeUnknown`),cls:`border-border bg-muted text-muted-foreground`}}}var F={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function I(){let{t:e}=o(),n=C(e=>e.inspectSessionId),r=C(e=>e.clearInspectSession),{inspectSession:s}=y(),p=S(e=>e.wsConnected),{payload:v,loading:b,error:k,clear:I}=O(),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1);(0,D.useEffect)(()=>{A()},[]),(0,D.useEffect)(()=>{n&&(O.getState().setLoading(!0),s(n))},[n,s]),(0,D.useEffect)(()=>()=>I(),[I]);let H=(0,D.useCallback)(()=>{r()},[r]),U=(0,D.useCallback)(()=>{n&&(O.getState().setLoading(!0),s(n))},[n,s]),W=(0,D.useMemo)(()=>R?v?.events.filter(e=>e.label.toLowerCase().includes(R.toLowerCase())||e.type.toLowerCase().includes(R.toLowerCase()))??[]:v?.events??[],[v,R]),G=(0,D.useMemo)(()=>v?Object.entries(v.toolBreakdown).sort(([,e],[,t])=>t-e):[],[v]);if(b)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-4 border border-border/60 bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(f,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(k)return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 bg-[hsl(var(--surface-2)/0.45)] p-6`,children:[(0,j.jsx)(a,{className:`h-8 w-8 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:k}),(0,j.jsxs)(`button`,{type:`button`,onClick:H,className:`mt-2 inline-flex items-center gap-1.5 border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!n)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,j.jsx)(l,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!v)return null;let K=P(v.outcome,e),q=v.name||v.title||`Untitled`;return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[hsl(var(--surface-2)/0.45)] overflow-y-auto overscroll-contain`,children:[(0,j.jsx)(`header`,{className:`sticky top-0 z-10 shrink-0 border-b border-border/70 bg-card/90 px-4 py-3 backdrop-blur-sm`,children:(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:H,className:`mb-2 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),v.outcome?(0,j.jsx)(`span`,{className:x(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{className:`font-mono`,children:[v.provider,`/`,v.model]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(m,{className:`h-3 w-3`}),E(v.startedAt)]}),(0,j.jsx)(`span`,{children:w({id:v.id,title:v.title,startedAt:v.startedAt,endedAt:v.endedAt,model:v.model,provider:v.provider,tokenTotal:v.tokenTotal,isCurrent:!1})}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,v.id.slice(0,12),`…`]})]}),v.lastUserMessage?(0,j.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:v.lastUserMessage,children:[`"`,v.lastUserMessage,`"`]}):null]}),(0,j.jsxs)(`button`,{type:`button`,onClick:U,disabled:!p,className:`inline-flex h-8 items-center gap-1 border border-border/70 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:bg-muted disabled:opacity-40`,title:e(`activity:sessionInspect.refresh`),children:[(0,j.jsx)(g,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,j.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,j.jsx)(L,{icon:u,label:e(`activity:sessionInspect.tokens`),value:T(v.tokenTotal)}),(0,j.jsx)(L,{icon:c,label:e(`activity:sessionInspect.messages`),value:T(v.messageCount)}),(0,j.jsx)(L,{icon:i,label:e(`activity:sessionInspect.iterations`),value:T(v.iterationCount)}),(0,j.jsx)(L,{icon:d,label:e(`activity:sessionInspect.toolCalls`),value:T(v.toolCallCount),errorCount:v.toolErrorCount>0?v.toolErrorCount:void 0}),(0,j.jsx)(L,{icon:h,label:e(`activity:sessionInspect.files`),value:T(v.fileChangeCount)}),(0,j.jsx)(L,{icon:g,label:e(`activity:sessionInspect.compactions`),value:T(v.compactionCount)}),(0,j.jsx)(L,{icon:t,label:e(`activity:sessionInspect.events`),value:T(v.events.length)})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,j.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(t,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,v.events.length]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(l,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(`input`,{type:`search`,value:R,onChange:e=>z(e.target.value),placeholder:e(`activity:sessionInspect.filterEvents`),className:`h-7 w-36 border border-border/60 bg-background pl-7 pr-2 text-[11px] outline-none focus:border-primary`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>V(!B),className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:text-foreground`,children:B?`Expand`:`Collapse`})]})]}),!B&&(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,j.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:e(`activity:sessionInspect.noEventsMatchTheFilter`)}):W.map((e,t)=>{let n=M[e.type]??i;return(0,j.jsxs)(`div`,{className:x(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,N(e.type)),children:[(0,j.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,j.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,j.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,j.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(d,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,j.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,v.fileEvents.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(h,{className:`h-4 w-4 text-success`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:v.fileEvents.length})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:v.fileEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,j.jsx)(`span`,{className:x(`shrink-0 inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,e.operation===`delete`?`border-destructive/30 bg-destructive/10 text-destructive`:e.operation===`create`?`border-success/30 bg-success/10 text-success`:`border-border bg-muted text-muted-foreground`),children:F[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function L({icon:e,label:t,value:n,errorCount:r}){return(0,j.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,j.jsx)(e,{className:`h-3 w-3`}),t]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,j.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{I as SessionInspectView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Dr as n,Fa as r,Gi as i,Li as a,Ot as o,Pa as s,Sa as c,Xn as l,an as u,ar as d,ft as f,ka as p,lt as m,pn as h,ra as g,si as _,xi as v}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as y}from"./useWebSocket-B2opfRwA.js";import{t as b}from"./ws-client-CGEB75Dy.js";import{t as x}from"./utils-CUCQrODG.js";import{I as S}from"./stores-BATHCuMN.js";import{n as C}from"./ui-store-BGNdg1e4.js";import{i as w,n as T,r as E}from"./SessionList-DLoIKc1b.js";var D=e(t(),1),O=s(e=>({payload:null,loading:!1,error:null,setPayload:t=>e({payload:t,loading:!1,error:null}),setError:t=>e({error:t,loading:!1}),setLoading:t=>e({loading:t}),clear:()=>e({payload:null,loading:!1,error:null})})),k=!1;function A(){if(k)return;let e=S.getState().wsUrl;e&&(b(e).on(`session.inspect`,e=>{let t=e.payload,n=O.getState();t?.error?n.setError(t.error):t&&n.setPayload(t)}),k=!0)}var j=m(),M={session_start:p,session_resumed:h,user_input:l,llm_request:v,llm_response:v,tool_use:f,tool_call_start:f,tool_call_end:f,tool_result:f,compaction:h,context_snapshot:n,error:a,session_end:i,message_appended:l,message_updated:l,messages_replaced:l,messages_dropped:l,file_event:_,mode_changed:p,task_created:p,task_updated:p,task_completed:i,task_failed:a,agent_spawned:p,agent_stopped:p,agent_error:a,provider_retry:h,provider_error:o};function N(e){switch(e){case`error`:case`task_failed`:case`agent_error`:return`text-destructive border-destructive/30 bg-destructive/5`;case`tool_call_end`:case`tool_use`:case`tool_call_start`:return`text-primary border-primary/30 bg-primary/5`;case`file_event`:return`text-success border-success/30 bg-success/5`;case`compaction`:return`text-warning border-warning/30 bg-warning/5`;case`user_input`:return`text-foreground border-border`;default:return`text-muted-foreground border-border`}}function P(e,t){switch(e){case`completed`:return{label:t(`activity:sessionInspect.outcomeCompleted`),cls:`border-success/30 bg-success/10 text-success`};case`error`:return{label:t(`activity:sessionInspect.outcomeError`),cls:`border-destructive/30 bg-destructive/10 text-destructive`};case`timeout`:return{label:t(`activity:sessionInspect.outcomeTimeout`),cls:`border-warning/30 bg-warning/10 text-warning`};case`aborted`:return{label:t(`activity:sessionInspect.outcomeAborted`),cls:`border-muted-foreground/30 bg-muted text-muted-foreground`};default:return{label:t(`activity:sessionInspect.outcomeUnknown`),cls:`border-border bg-muted text-muted-foreground`}}}var F={create:`Created`,read:`Read`,update:`Modified`,delete:`Deleted`,rename:`Renamed`};function I(){let{t:e}=r(),t=C(e=>e.inspectSessionId),i=C(e=>e.clearInspectSession),{inspectSession:a}=y(),s=S(e=>e.wsConnected),{payload:m,loading:b,error:k,clear:I}=O(),[R,z]=(0,D.useState)(``),[B,V]=(0,D.useState)(!1);(0,D.useEffect)(()=>{A()},[]),(0,D.useEffect)(()=>{t&&(O.getState().setLoading(!0),a(t))},[t,a]),(0,D.useEffect)(()=>()=>I(),[I]);let H=(0,D.useCallback)(()=>{i()},[i]),U=(0,D.useCallback)(()=>{t&&(O.getState().setLoading(!0),a(t))},[t,a]),W=(0,D.useMemo)(()=>R?m?.events.filter(e=>e.label.toLowerCase().includes(R.toLowerCase())||e.type.toLowerCase().includes(R.toLowerCase()))??[]:m?.events??[],[m,R]),G=(0,D.useMemo)(()=>m?Object.entries(m.toolBreakdown).sort(([,e],[,t])=>t-e):[],[m]);if(b)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3 px-5 py-4 border border-border/60 bg-card text-sm text-muted-foreground`,children:[(0,j.jsx)(d,{className:`h-5 w-5 animate-spin text-primary`}),e(`activity:sessionInspect.loadingSessionInspection`)]})});if(k)return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-3 bg-[hsl(var(--surface-2)/0.45)] p-6`,children:[(0,j.jsx)(o,{className:`h-8 w-8 text-destructive`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:k}),(0,j.jsxs)(`button`,{type:`button`,onClick:H,className:`mt-2 inline-flex items-center gap-1.5 border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]})]});if(!t)return(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)]`,children:(0,j.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 p-6 text-center`,children:[(0,j.jsx)(u,{className:`h-9 w-9 text-muted-foreground opacity-30`}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e(`activity:sessionInspect.noSessionSelected`)}),(0,j.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:sessionInspect.selectASessionFromTheSessions`)})]})});if(!m)return null;let K=P(m.outcome,e),q=m.name||m.title||`Untitled`;return(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[hsl(var(--surface-2)/0.45)] overflow-y-auto overscroll-contain`,children:[(0,j.jsx)(`header`,{className:`sticky top-0 z-10 shrink-0 border-b border-border/70 bg-card/90 px-4 py-3 backdrop-blur-sm`,children:(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`button`,{type:`button`,onClick:H,className:`mb-2 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.backToSessions`)]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`h1`,{className:`truncate text-lg font-semibold tracking-tight`,title:q,children:q}),m.outcome?(0,j.jsx)(`span`,{className:x(`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,K.cls),children:K.label}):null]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,j.jsxs)(`span`,{className:`font-mono`,children:[m.provider,`/`,m.model]}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(g,{className:`h-3 w-3`}),E(m.startedAt)]}),(0,j.jsx)(`span`,{children:w({id:m.id,title:m.title,startedAt:m.startedAt,endedAt:m.endedAt,model:m.model,provider:m.provider,tokenTotal:m.tokenTotal,isCurrent:!1})}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`ID: `,m.id.slice(0,12),`…`]})]}),m.lastUserMessage?(0,j.jsxs)(`p`,{className:`mt-2 truncate text-xs text-muted-foreground`,title:m.lastUserMessage,children:[`"`,m.lastUserMessage,`"`]}):null]}),(0,j.jsxs)(`button`,{type:`button`,onClick:U,disabled:!s,className:`inline-flex h-8 items-center gap-1 border border-border/70 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:bg-muted disabled:opacity-40`,title:e(`activity:sessionInspect.refresh`),children:[(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),e(`activity:sessionInspect.refresh`)]})]})}),(0,j.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-4 p-4 sm:p-6`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-7`,children:[(0,j.jsx)(L,{icon:v,label:e(`activity:sessionInspect.tokens`),value:T(m.tokenTotal)}),(0,j.jsx)(L,{icon:l,label:e(`activity:sessionInspect.messages`),value:T(m.messageCount)}),(0,j.jsx)(L,{icon:p,label:e(`activity:sessionInspect.iterations`),value:T(m.iterationCount)}),(0,j.jsx)(L,{icon:f,label:e(`activity:sessionInspect.toolCalls`),value:T(m.toolCallCount),errorCount:m.toolErrorCount>0?m.toolErrorCount:void 0}),(0,j.jsx)(L,{icon:_,label:e(`activity:sessionInspect.files`),value:T(m.fileChangeCount)}),(0,j.jsx)(L,{icon:h,label:e(`activity:sessionInspect.compactions`),value:T(m.compactionCount)}),(0,j.jsx)(L,{icon:n,label:e(`activity:sessionInspect.events`),value:T(m.events.length)})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_20rem]`,children:[(0,j.jsxs)(`section`,{className:`min-w-0 border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(n,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.eventTimeline`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:[W.length,` / `,m.events.length]})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(u,{className:`pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(`input`,{type:`search`,value:R,onChange:e=>z(e.target.value),placeholder:e(`activity:sessionInspect.filterEvents`),className:`h-7 w-36 border border-border/60 bg-background pl-7 pr-2 text-[11px] outline-none focus:border-primary`})]}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>V(!B),className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:text-foreground`,children:B?`Expand`:`Collapse`})]})]}),!B&&(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:W.length===0?(0,j.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:e(`activity:sessionInspect.noEventsMatchTheFilter`)}):W.map((e,t)=>{let n=M[e.type]??p;return(0,j.jsxs)(`div`,{className:x(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-2.5 gap-y-0.5 px-3 py-2 text-xs`,N(e.type)),children:[(0,j.jsx)(n,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,children:e.label}),e.detail?(0,j.jsx)(`div`,{className:`truncate font-mono text-[10px] opacity-70`,children:e.detail}):null]}),(0,j.jsx)(`time`,{dateTime:e.ts,className:`whitespace-nowrap font-mono text-[10px] opacity-60`,children:new Date(e.ts).toLocaleTimeString()})]},`${e.ts}-${t}`)})})]}),(0,j.jsxs)(`aside`,{className:`flex flex-col gap-4`,children:[G.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(f,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.toolBreakdown`)})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:G.map(([e,t])=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 text-xs`,children:[(0,j.jsx)(`span`,{className:`truncate font-medium`,children:e}),(0,j.jsx)(`span`,{className:`ml-2 shrink-0 font-mono font-semibold tabular-nums`,children:t})]},e))})]}):null,m.fileEvents.length>0?(0,j.jsxs)(`section`,{className:`border border-border/70 bg-card/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-4 py-2.5`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-success`}),(0,j.jsx)(`h2`,{className:`text-sm font-semibold`,children:e(`activity:sessionInspect.fileChanges`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:m.fileEvents.length})]}),(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:m.fileEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-2 px-4 py-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-mono font-medium`,title:e.filePath,children:e.filePath}),(0,j.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:e.toolName})]}),(0,j.jsx)(`span`,{className:x(`shrink-0 inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,e.operation===`delete`?`border-destructive/30 bg-destructive/10 text-destructive`:e.operation===`create`?`border-success/30 bg-success/10 text-success`:`border-border bg-muted text-muted-foreground`),children:F[e.operation]??e.operation})]},`${e.filePath}-${t}`))})]}):null]})]})]})]})}function L({icon:e,label:t,value:n,errorCount:r}){return(0,j.jsxs)(`div`,{className:`border border-border/70 bg-card/70 px-3 py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,j.jsx)(e,{className:`h-3 w-3`}),t]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{className:`font-mono text-lg font-semibold tabular-nums`,children:n}),r!==void 0&&r>0?(0,j.jsxs)(`span`,{className:`font-mono text-xs text-destructive`,children:[`(`,r,` err)`]}):null]})]})}export{I as SessionInspectView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Dr as n,Fa as r,Gi as i,Mi as a,On as o,Ot as s,Ra as c,Tn as l,an as u,ar as d,dt as ee,ft as f,jt as te,ka as p,lt as m,on as ne,si as h,vn as re,zi as g,zt as _}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as v}from"./utils-CUCQrODG.js";import"./stores-BATHCuMN.js";import{n as y}from"./ui-store-BGNdg1e4.js";import{r as b}from"./ConfirmModal-DXy17_uy.js";import{b as ie}from"./index-BTRQG7C5.js";var x=e(t(),1),S=m(),ae=10,oe=20,C=e=>{if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t},w=e=>(e.iterationCount??0)+(e.toolCallCount??0)+(e.fileChangeCount??0),T=e=>{let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.max(0,Date.now()-t);if(n<6e4)return c.t(`common:time.justNow`);if(n<36e5)return c.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return c.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let r=Math.floor(n/864e5);return r<7?c.t(`common:time.daysAgo`,{count:r}):new Date(t).toLocaleDateString()},E=e=>e.lastActivityAt??e.endedAt??e.startedAt;function D(e){let t=C(e.startedAt);if(!t)return``;let n=e.isCurrent?Date.now():C(e.endedAt)||t,r=Math.max(0,Math.floor((n-t)/6e4));if(r<1)return`<1m`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function O(e){return new Intl.NumberFormat(void 0,{notation:e>=1e3?`compact`:`standard`,maximumFractionDigits:1}).format(e)}function se(e){return e.filter(e=>e.tokenTotal===0&&!e.isCurrent).map(e=>e.id)}function ce(e,t){let n=t.query.trim().toLocaleLowerCase(),r=new Set(t.favoriteIds);return[...e.filter(e=>{if(!(!n||[e.name,e.title,e.lastUserMessage,e.model,e.provider,e.id,...Object.keys(e.toolBreakdown??{})].some(e=>e?.toLocaleLowerCase().includes(n))))return!1;switch(t.filter){case`favorites`:return r.has(e.id);case`active`:return e.isCurrent;case`completed`:return!e.isCurrent&&(e.outcome===`completed`||e.outcome===void 0&&!!e.endedAt);case`issues`:return e.outcome===`error`||e.outcome===`timeout`||e.outcome===`aborted`||(e.toolErrorCount??0)>0;default:return!0}})].sort((e,n)=>{if(t.sort===`tokens`&&n.tokenTotal!==e.tokenTotal)return n.tokenTotal-e.tokenTotal;if(t.sort===`activity`){let t=w(n)-w(e);if(t!==0)return t}return C(E(n))-C(E(e))})}function le(e,t,n=Date.now()){let r=new Date(n);r.setHours(0,0,0,0);let i=r.getTime(),a=i-864e5,o=i-6*864e5,s=new Set(t),c=e.filter(e=>s.has(e.id)),l={today:[],yesterday:[],thisWeek:[],earlier:[]};for(let t of e){if(s.has(t.id))continue;let e=C(E(t));e>=i?l.today.push(t):e>=a?l.yesterday.push(t):e>=o?l.thisWeek.push(t):l.earlier.push(t)}let u=[];c.length>0&&u.push({label:`favorites`,rows:c,favorite:!0});for(let e of[`today`,`yesterday`,`thisWeek`,`earlier`])l[e].length>0&&u.push({label:e,rows:l[e]});return u}function ue(e){return e.reduce((e,t)=>({sessions:e.sessions+1,active:e.active+ +!!t.isCurrent,tokens:e.tokens+t.tokenTotal,tools:e.tools+(t.toolCallCount??0),files:e.files+(t.fileChangeCount??0),errors:e.errors+(t.toolErrorCount??0)+ +(t.outcome===`error`)}),{sessions:0,active:0,tokens:0,tools:0,files:0,errors:0})}function de(e){if(e.isCurrent)return{icon:p,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:s,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:a,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:g,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:i,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:n,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t}=r();return(0,S.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/75 bg-card md:grid-cols-5`,children:[{label:t(`activity:sessions.stats.sessions`,{defaultValue:`Sessions`}),value:e.sessions,icon:n},{label:t(`activity:sessions.stats.tokens`,{defaultValue:`Tokens`}),value:e.tokens,icon:p},{label:t(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:f},{label:t(`activity:sessions.stats.files`,{defaultValue:`Files changed`}),value:e.files,icon:h},{label:t(`activity:sessions.stats.errors`,{defaultValue:`Errors`}),value:e.errors,icon:s}].map(e=>{let t=e.icon;return(0,S.jsxs)(`div`,{className:`border-b border-r border-border/75 px-4 py-3 md:border-b-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-3 w-3`}),e.label]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums`,children:O(e.value)})]},e.label)})})}function k({historyQuery:e,setHistoryQuery:t,historyEntries:i,historyLoading:a,historyError:c,wsConnected:p,listSessions:m,resumeSession:g,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=r(),j=y(e=>e.favoriteSessionIds),pe=y(e=>e.toggleFavoriteSession),M=y(e=>e.sessionNicknames),N=y(e=>e.setSessionNickname),me=y(e=>e.setInspectSession),[P,he]=(0,x.useState)(`all`),[F,ge]=(0,x.useState)(`recent`),[I,L]=(0,x.useState)(null),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(null),[H,U]=(0,x.useState)(1),W=(0,x.useRef)(null),G=(0,x.useRef)(null),K=k===`workspace`,q=(0,x.useCallback)(e=>e.name||M[e.id]||e.title||A(`activity:sessions.empty`),[M,A]),J=(0,x.useCallback)(e=>{L(e.id),z(e.name??M[e.id]??e.title??``)},[M]),Y=(0,x.useCallback)(e=>{L(null),N(e,R),w(e,R)},[R,w,N]);(0,x.useEffect)(()=>{B&&i.some(e=>e.id===B&&e.isCurrent)&&(V(null),W.current&&clearTimeout(W.current))},[i,B]),(0,x.useEffect)(()=>{I&&(G.current?.focus(),G.current?.select())},[I]),(0,x.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let X=(0,x.useCallback)(e=>{V(e),g(e),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>V(null),1e4)},[g]),Z=(0,x.useMemo)(()=>se(i),[i]),Q=(0,x.useMemo)(()=>ce(i,{query:e,filter:P,sort:F,favoriteIds:j}),[j,P,i,e,F]),$=K?oe:ae,_e=(0,x.useMemo)(()=>Q.slice((H-1)*$,H*$),[H,$,Q]),ve=(0,x.useMemo)(()=>le(_e,j),[j,_e]),ye=(0,x.useMemo)(()=>ue(i),[i]);(0,x.useEffect)(()=>{U(1)},[P,e,F]),(0,x.useEffect)(()=>{let e=Math.max(1,Math.ceil(Q.length/$));H>e&&U(e)},[H,$,Q.length]);let be=(0,x.useCallback)(async()=>{if(Z.length!==0&&await b({title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),message:A(`activity:sessions.deleteEmptyConfirmBody`),confirmLabel:A(`common:action.delete`),danger:!0}))for(let e of Z)C(e)},[C,Z,A]),xe=[{id:`all`,label:A(`activity:sessions.filters.all`,{defaultValue:`All`})},{id:`favorites`,label:A(`activity:sessions.filters.favorites`,{defaultValue:`Pinned`})},{id:`active`,label:A(`activity:sessions.filters.active`,{defaultValue:`Active`})},{id:`completed`,label:A(`activity:sessions.filters.completed`,{defaultValue:`Completed`})},{id:`issues`,label:A(`activity:sessions.filters.issues`,{defaultValue:`Issues`})}];return(0,S.jsxs)(`div`,{className:v(`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,K&&`h-full`),"data-history-variant":k,children:[K?(0,S.jsx)(fe,{stats:ye}):null,(0,S.jsxs)(`div`,{className:v(`border-b border-border/75 bg-card`,K?`px-4 py-3`:`px-3 py-2`),children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:A(`activity:sessions.recentSessions`)}),K?(0,S.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:A(`activity:sessions.workspaceHint`,{defaultValue:`Search, inspect, pin and resume every project conversation.`})}):null]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center border border-border/75`,children:[Z.length>0?(0,S.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center gap-1 border-r border-border/75 px-2 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:opacity-40`,onClick:be,disabled:!p,title:A(`activity:sessions.deleteEmptyTitle`,{count:Z.length}),children:[(0,S.jsx)(te,{className:`h-3.5 w-3.5`}),K?(0,S.jsx)(`span`,{className:`text-[10px]`,children:Z.length}):null]}):null,(0,S.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:()=>m(200),disabled:!p,title:A(`common:action.refresh`),children:a?(0,S.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(re,{className:`h-3.5 w-3.5`})})]})]}),(0,S.jsxs)(`div`,{className:v(`grid gap-2`,K?`mt-3 lg:grid-cols-[minmax(18rem,1fr)_auto_auto]`:`mt-2`),children:[(0,S.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,S.jsx)(u,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,S.jsx)(`input`,{type:`search`,value:e,onChange:e=>t(e.target.value),placeholder:A(`activity:sessions.filterPlaceholder`),"aria-label":A(`activity:sessions.filterPlaceholder`),className:`h-9 w-full border border-border/75 bg-background pl-8 pr-8 text-xs outline-none transition-colors placeholder:text-muted-foreground/70 focus:border-primary focus:ring-1 focus:ring-primary`}),e?(0,S.jsx)(`button`,{type:`button`,onClick:()=>t(``),className:`absolute right-0 top-0 inline-flex h-9 w-8 items-center justify-center text-muted-foreground hover:text-foreground`,title:A(`activity:sessions.clearFilter`),children:(0,S.jsx)(ee,{className:`h-3.5 w-3.5`})}):null]}),(0,S.jsxs)(`fieldset`,{className:`flex min-w-0 overflow-x-auto border border-border/75`,children:[(0,S.jsx)(`legend`,{className:`sr-only`,children:A(`activity:sessionList.historyFilters`)}),xe.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>he(e.id),"aria-pressed":P===e.id,className:v(`h-9 shrink-0 border-r border-border/75 px-2.5 text-[10px] font-semibold uppercase tracking-[0.08em] transition-colors last:border-r-0`,P===e.id?`bg-foreground text-background`:`bg-background text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.label},e.id))]}),(0,S.jsxs)(`select`,{value:F,onChange:e=>ge(e.target.value),"aria-label":A(`activity:sessions.sort.label`,{defaultValue:`Sort sessions`}),className:`h-9 border border-border/75 bg-background px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground outline-none focus:border-primary`,children:[(0,S.jsx)(`option`,{value:`recent`,children:A(`activity:sessions.sort.recent`,{defaultValue:`Recent`})}),(0,S.jsx)(`option`,{value:`tokens`,children:A(`activity:sessions.sort.tokens`,{defaultValue:`Most tokens`})}),(0,S.jsx)(`option`,{value:`activity`,children:A(`activity:sessions.sort.activity`,{defaultValue:`Most activity`})})]})]})]}),c?(0,S.jsx)(`div`,{className:`border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:c}):null,(0,S.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain overflow-x-hidden [scrollbar-gutter:stable]`,children:i.length===0&&!a?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(n,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noHistory`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noHistoryHint`)})]}):ve.length===0?(0,S.jsxs)(`div`,{className:`flex min-h-56 flex-col items-center justify-center px-4 py-10 text-center text-muted-foreground`,children:[(0,S.jsx)(u,{className:`h-9 w-9 opacity-25`}),(0,S.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:A(`activity:sessions.noMatches`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs`,children:A(`activity:sessions.noMatchesHint`)})]}):(0,S.jsxs)(`div`,{className:v(K?`mx-auto w-full max-w-7xl p-4 lg:p-6`:`p-2`),children:[(0,S.jsx)(`div`,{className:v(`space-y-5`,K&&`grid gap-x-5 space-y-0 xl:grid-cols-2`),children:ve.map(e=>(0,S.jsxs)(`section`,{className:`min-w-0`,children:[(0,S.jsxs)(`div`,{className:v(`sticky top-0 z-[1] flex items-center gap-1 border-b border-border/75 bg-background/95 px-1 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] backdrop-blur-sm`,e.favorite?`text-warning`:`text-muted-foreground`),children:[e.favorite?(0,S.jsx)(_,{className:`h-3 w-3 fill-current`}):null,A(`activity:sessions.group.${e.label}`),(0,S.jsx)(`span`,{className:`ml-1 font-mono font-normal text-muted-foreground`,children:e.rows.length})]}),(0,S.jsx)(`div`,{className:`divide-y divide-border/75 border-x border-b border-border/75`,children:e.rows.map(e=>{let t=j.includes(e.id),n=de(e),r=n.icon,i=I===e.id,a=B===e.id;return(0,S.jsxs)(`article`,{className:v(`group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] bg-card transition-colors`,e.isCurrent?`border-l-2 border-l-primary bg-primary/5`:`border-l-2 border-l-transparent hover:bg-muted/45`),"data-session-id":e.id,children:[i?(0,S.jsxs)(`div`,{className:`min-w-0 px-3 py-3`,children:[(0,S.jsx)(`label`,{className:`block text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,htmlFor:`session-name-${e.id}`,children:A(`activity:sessions.rename`,{defaultValue:`Session name`})}),(0,S.jsx)(`input`,{ref:G,id:`session-name-${e.id}`,value:R,onChange:e=>z(e.target.value),onBlur:()=>Y(e.id),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),Y(e.id)):t.key===`Escape`&&(t.preventDefault(),L(null))},placeholder:e.title||A(`activity:sessions.nicknamePlaceholder`),className:`mt-1 h-8 w-full border border-primary bg-background px-2 text-sm outline-none ring-1 ring-primary`})]}):(0,S.jsx)(`button`,{type:`button`,disabled:e.isCurrent||B!==null,onClick:()=>X(e.id),onDoubleClick:()=>J(e),"aria-current":e.isCurrent?`page`:void 0,className:`min-w-0 px-3 py-3 text-left outline-none focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:cursor-default`,children:(0,S.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,S.jsx)(`span`,{className:v(`mt-0.5 shrink-0`,n.className),title:A(`activity:sessions.status.${n.label}`,{defaultValue:n.defaultLabel}),children:(0,S.jsx)(r,{className:v(`h-3.5 w-3.5`,e.isCurrent&&`animate-pulse`)})}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,title:q(e),children:q(e)}),(0,S.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.provider,`/`,e.model]}),e.lastUserMessage?(0,S.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground`,title:e.lastUserMessage,children:e.lastUserMessage}):null,(0,S.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] text-muted-foreground`,children:[a?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(d,{className:`h-3 w-3 animate-spin`}),A(`activity:sessions.resuming`)]}):(0,S.jsx)(`span`,{title:new Date(E(e)).toLocaleString(),children:T(E(e))}),(0,S.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,S.jsx)(`span`,{children:D(e)}),e.tokenTotal>0?(0,S.jsxs)(`span`,{children:[O(e.tokenTotal),` tok`]}):null,(e.messageCount??0)>0?(0,S.jsxs)(`span`,{children:[O(e.messageCount??0),` msg`]}):null,(e.toolCallCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(f,{className:`h-3 w-3`}),e.toolCallCount]}):null,(e.fileChangeCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,S.jsx)(h,{className:`h-3 w-3`}),e.fileChangeCount]}):null,(e.toolErrorCount??0)>0?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-destructive`,children:[(0,S.jsx)(s,{className:`h-3 w-3`}),e.toolErrorCount]}):null]})]})]})}),(0,S.jsxs)(`div`,{className:`flex items-start gap-0.5 p-2`,children:[!e.isCurrent&&K&&!i?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>X(e.id),disabled:B!==null,className:`inline-flex h-7 items-center gap-1 border border-border/75 px-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground hover:border-primary hover:text-primary disabled:opacity-40`,title:A(`activity:sessions.resume`,{defaultValue:`Resume session`}),children:[(0,S.jsx)(l,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,i?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>me(e.id),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.inspect`,{defaultValue:`Inspect session`}),children:(0,S.jsx)(ne,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":t,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,t?`text-warning`:`text-muted-foreground`),title:A(t?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,t&&`fill-current`)})}),i?null:(0,S.jsx)(`button`,{type:`button`,onClick:()=>J(e),className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-primary/10 hover:text-primary`,title:A(`activity:sessions.renameAction`,{defaultValue:`Rename`}),children:(0,S.jsx)(o,{className:`h-3.5 w-3.5`})}),e.isCurrent?null:(0,S.jsx)(`button`,{type:`button`,onClick:async()=>{await b({title:A(`activity:sessions.deleteSessionConfirmTitle`),message:A(`activity:sessions.deleteSessionConfirmBody`,{name:q(e)}),confirmLabel:A(`common:action.delete`),danger:!0})&&C(e.id)},className:`inline-flex h-7 w-7 items-center justify-center text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:A(`activity:sessions.deleteSessionTitle`),children:(0,S.jsx)(te,{className:`h-3.5 w-3.5`})})]})]},e.id)})})]},e.label))}),(0,S.jsx)(ie,{page:H,pageSize:$,totalItems:Q.length,onPageChange:U,compact:!K,itemLabel:`sessions`})]})})]})}export{D as i,O as n,T as r,k as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Er as n,Ki as r,Kr as i,La as a,Oa as o,Pa as s,Vi as c,Wi as l,bi as u,ir as d,ja as f,lt as p,mt as m,pt as h,yn as g,za as _}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as v}from"./useWebSocket-CZSpbA3M.js";import{t as y}from"./utils-B-9lSDIn.js";import{t as b}from"./session-store-Df7_hhe9.js";import{I as x,h as S}from"./stores-vuG0AaKy.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-FHt-sKVF.js";import{t as k}from"./SessionList-C3ygQN8A.js";var A=e(_(),1),j=p(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(o,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(g,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(t,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(r,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(c,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(h,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(t,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return a.t(`common:time.justNow`);if(n<60)return a.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?a.t(`common:time.minutesAgo`,{count:r}):a.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(f(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:o,deleteSession:s,renameSession:c}=v(),[l,u]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:l,setHistoryQuery:u,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:o,deleteSession:s,renameSession:c,variant:`workspace`})}function z(){let{t:e}=s();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(g,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=s(),[n,a]=(0,A.useState)([]),[o,c]=(0,A.useState)(!0),[l,f]=(0,A.useState)(null),[p,g]=(0,A.useState)(1),_=D(`sessions`,!o&&!l&&n.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){f(null),a([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){f(null),a([]);return}let t=await e.json();if(!Array.isArray(t)){f(null),a([]);return}a(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),f(null)}catch(e){if(e instanceof SyntaxError){f(null),a([]);return}f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=n.filter(e=>e.status===`active`).length,x=n.reduce((e,t)=>e+t.agentCount,0),S=n.slice((p-1)*M,p*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(n.length/M));p>e&&g(e)},[p,n.length]),o?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(d,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):l?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(r,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:l})]})}):n.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(m,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:_,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(h,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:n.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:n.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(n=>{let r=F(n.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:r.cls,children:r.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:n.projectName,children:n.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:n.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${r.badge}`,children:n.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:n.workingDir,children:n.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(i,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:n.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(t,{className:`h-3.5 w-3.5`}),I(n.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:n.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:n.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:n.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(n.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[n.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:n.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),n.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:n.agents.length-5})}):null]})]},n.sessionId)})}),(0,j.jsx)(E,{page:p,pageSize:M,totalItems:n.length,onPageChange:g,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Dr as n,Fa as r,Gi as i,Hi as a,Ma as o,Ra as s,ar as c,ji as l,ka as u,lt as d,mt as f,pt as p,qi as m,qr as h,xi as g,yn as _}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as v}from"./useWebSocket-B2opfRwA.js";import{t as y}from"./utils-CUCQrODG.js";import{t as b}from"./session-store-Ce4Dck2K.js";import{I as x,h as S}from"./stores-BATHCuMN.js";import{C,E as w,T,b as E,c as D,w as O}from"./index-BTRQG7C5.js";import{t as k}from"./SessionList-DLoIKc1b.js";var A=e(t(),1),j=d(),M=12;async function N(e){try{let t=await e.clone().json(),n=typeof t.error==`string`?t.error:t.message;if(typeof n==`string`&&n.trim())return n}catch{try{let t=await e.text();if(t.trim())return t.trim()}catch{}}return e.statusText||`HTTP ${e.status}`}function P(e){switch(e){case`running`:return{icon:(0,j.jsx)(u,{className:`h-3.5 w-3.5`}),cls:`text-success`};case`streaming`:return{icon:(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),cls:`text-primary`};case`waiting_user`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-warning`};case`error`:return{icon:(0,j.jsx)(m,{className:`h-3.5 w-3.5`}),cls:`text-destructive`};case`idle`:return{icon:(0,j.jsx)(a,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`};default:return{icon:(0,j.jsx)(i,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`}}}function F(e){switch(e){case`active`:return{icon:(0,j.jsx)(p,{className:`h-3.5 w-3.5`}),cls:`text-success`,badge:`border-success/25 bg-success/8 text-success`};case`idle`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-primary`,badge:`border-primary/25 bg-primary/10 text-primary`};case`closing`:return{icon:(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),cls:`text-warning`,badge:`border-warning/25 bg-warning/10 text-warning`};case`lost`:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-destructive/60`,badge:`border-destructive/15 bg-destructive/5 text-destructive/70`};default:return{icon:(0,j.jsx)(f,{className:`h-3.5 w-3.5`}),cls:`text-muted-foreground`,badge:`border-border bg-muted text-muted-foreground`}}}function I(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`<1m`;if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function L(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<10)return s.t(`common:time.justNow`);if(n<60)return s.t(`common:time.secondsAgo`,{count:n});let r=Math.floor(n/60);return r<60?s.t(`common:time.minutesAgo`,{count:r}):s.t(`common:time.hoursAgo`,{count:Math.floor(r/60)})}function R(){let e=x(e=>e.wsConnected),t=b(e=>e.session?.id),{entries:n,loading:r,error:i}=S(o(e=>({entries:e.entries,loading:e.loading,error:e.error}))),{listSessions:a,resumeSession:s,deleteSession:c,renameSession:l}=v(),[u,d]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e&&a(200)},[t,a,e]),(0,j.jsx)(k,{historyQuery:u,setHistoryQuery:d,historyEntries:n,historyLoading:r,historyError:i,wsConnected:e,listSessions:a,resumeSession:s,deleteSession:c,renameSession:l,variant:`workspace`})}function z(){let{t:e}=r();return(0,j.jsxs)(C,{defaultValue:`history`,className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`sessions-workspace`,children:[(0,j.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border/75 bg-card px-4 py-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-primary`,children:e(`activity:sessions.workspaceEyebrow`,{defaultValue:`Conversation control`})}),(0,j.jsx)(`h1`,{className:`mt-0.5 text-lg font-semibold tracking-tight`,children:e(`activity:sessions.workspaceTitle`,{defaultValue:`Sessions`})})]}),(0,j.jsxs)(T,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(w,{value:`history`,className:`h-9 gap-1.5 border-r border-border/75 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(n,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.history`,{defaultValue:`History`})]}),(0,j.jsxs)(w,{value:`live`,className:`h-9 gap-1.5 px-3 text-xs shadow-none data-[state=active]:bg-foreground data-[state=active]:text-background data-[state=active]:ring-0`,children:[(0,j.jsx)(_,{className:`h-3.5 w-3.5`}),e(`activity:sessions.tabs.live`,{defaultValue:`Live sessions`})]})]})]}),(0,j.jsx)(O,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(O,{value:`live`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(B,{})})]})}function B(){let{t:e}=r(),[t,n]=(0,A.useState)([]),[i,a]=(0,A.useState)(!0),[o,s]=(0,A.useState)(null),[u,d]=(0,A.useState)(1),_=D(`sessions`,!i&&!o&&t.length>0),v=(0,A.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(!e.ok){if(e.status===404){s(null),n([]);return}throw Error(`HTTP ${e.status}: ${await N(e)}`)}if(!(e.headers.get(`content-type`)?.toLowerCase()??``).includes(`application/json`)){s(null),n([]);return}let t=await e.json();if(!Array.isArray(t)){s(null),n([]);return}n(e=>{let n=t;if(e.length===n.length){let t=!0;for(let r=0;r<n.length;r++){let i=n[r],a=e[r];if(i.sessionId!==a.sessionId||i.status!==a.status||i.agentCount!==a.agentCount||i.startedAt!==a.startedAt){t=!1;break}}if(t)return e}return n}),s(null)}catch(e){if(e instanceof SyntaxError){s(null),n([]);return}s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[]);(0,A.useEffect)(()=>{v();let e=setInterval(v,5e3);return()=>clearInterval(e)},[v]);let b=t.filter(e=>e.status===`active`).length,x=t.reduce((e,t)=>e+t.agentCount,0),S=t.slice((u-1)*M,u*M);return(0,A.useEffect)(()=>{let e=Math.max(1,Math.ceil(t.length/M));u>e&&d(e)},[u,t.length]),i?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground`,children:[(0,j.jsx)(c,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:liveSessions.loading`)]})}):o?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-lg p-5 text-center`,children:[(0,j.jsx)(m,{className:`mx-auto h-8 w-8 text-warning`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:e(`activity:liveSessions.apiUnavailable`)}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-xs text-muted-foreground`,children:o})]})}):t.length===0?(0,j.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,j.jsxs)(`div`,{className:`ws-surface max-w-md p-6 text-center text-muted-foreground`,children:[(0,j.jsx)(f,{className:`mx-auto h-9 w-9 opacity-50`}),(0,j.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:e(`activity:liveSessions.empty`)}),(0,j.jsx)(`p`,{className:`mt-1 text-xs`,children:e(`activity:liveSessions.autoRefresh`)})]})}):(0,j.jsx)(`div`,{ref:_,className:`h-full min-h-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,j.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-4`,children:[(0,j.jsx)(`header`,{className:`border border-border/70 bg-card/75 p-4`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(p,{className:`h-4 w-4 text-primary`}),(0,j.jsx)(`h2`,{className:`text-base font-semibold`,children:e(`activity:liveSessions.heading`,{count:t.length})})]}),(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:liveSessions.autoRefresh`)})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center sm:min-w-[22rem]`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t.length}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.sessions`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-success`,children:b}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.active`)})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/60 px-3 py-2`,children:[(0,j.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:x}),(0,j.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e(`activity:sessionsDash.agents`)})]})]})]})}),(0,j.jsx)(`div`,{className:`grid gap-3`,children:S.map(t=>{let n=F(t.status);return(0,j.jsxs)(`article`,{className:`border border-border/70 bg-card/75 p-3 sm:p-4`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:n.cls,children:n.icon}),(0,j.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold`,title:t.projectName,children:t.projectName}),(0,j.jsx)(`span`,{className:`bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:t.projectSlug}),(0,j.jsx)(`span`,{className:`inline-flex items-center border px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.badge}`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1.5 text-xs text-muted-foreground md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,j.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono`,title:t.workingDir,children:t.workingDir})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.gitBranch?(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1 text-primary`,children:[(0,j.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate font-mono`,children:t.gitBranch})]}):null,(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(l,{className:`h-3.5 w-3.5`}),I(t.startedAt)]}),(0,j.jsx)(`span`,{className:`font-mono`,children:e(`activity:liveSessions.pidLabel`,{pid:t.pid})})]})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs sm:grid-cols-3 lg:w-64`,children:[(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.agents`)}),(0,j.jsx)(`div`,{className:`font-semibold tabular-nums`,children:t.agentCount})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.status`)}),(0,j.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t.status})]}),(0,j.jsxs)(`div`,{className:`border border-border/70 bg-background/50 px-2 py-1.5`,children:[(0,j.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e(`activity:sessionsDash.runtime`)}),(0,j.jsx)(`div`,{className:`font-mono font-semibold`,children:I(t.startedAt)})]})]})]}),(0,j.jsxs)(`div`,{className:`mt-3 overflow-hidden border border-border/70 bg-background/45`,children:[t.agents.length===0?(0,j.jsx)(`div`,{className:`px-3 py-3 text-xs text-muted-foreground`,children:e(`activity:liveSessions.noAgents`)}):(0,j.jsx)(`div`,{className:`divide-y divide-border/60`,children:t.agents.slice(0,5).map(t=>{let n=P(t.status);return(0,j.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 px-3 py-2 text-xs sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,14rem)_auto]`,children:[(0,j.jsx)(`span`,{className:y(`mt-0.5 shrink-0`,n.cls),children:n.icon}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`div`,{className:`truncate font-medium`,title:t.name,children:t.name}),(0,j.jsx)(`div`,{className:`font-mono text-[10px] text-muted-foreground`,children:e(`activity:liveSessions.agentMeta`,{iter:t.iterations,tools:t.toolCalls,ago:L(t.lastActivityAt)})})]}),(0,j.jsx)(`div`,{className:`min-w-0 font-mono text-[10px] text-muted-foreground sm:text-xs`,children:t.currentTool?(0,j.jsx)(`span`,{className:`block truncate`,title:t.currentTool,children:t.currentTool}):(0,j.jsx)(`span`,{className:`text-muted-foreground/75`,children:t.status})}),(0,j.jsx)(`span`,{className:`hidden font-mono text-[10px] text-muted-foreground sm:block`,children:L(t.lastActivityAt)})]},t.id)})}),t.agents.length>5?(0,j.jsx)(`div`,{className:`border-t border-border/60 px-3 py-2 text-xs text-muted-foreground`,children:e(`activity:liveSessions.andMore`,{count:t.agents.length-5})}):null]})]},t.sessionId)})}),(0,j.jsx)(E,{page:u,pageSize:M,totalItems:t.length,onPageChange:d,itemLabel:`sessions`})]})})}export{z as SessionsDashboard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ba as n,Ci as r,Fa as i,Fr as a,Jt as o,Ma as s,Ra as c,Wt as l,Zi as u,ar as d,ba as f,br as p,ea as m,en as h,fi as g,jr as _,lt as v,t as y,ua as b,vn as x,wn as ee}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as S}from"./useWebSocket-B2opfRwA.js";import{t as C}from"./ws-client-CGEB75Dy.js";import{t as w}from"./utils-CUCQrODG.js";import{I as T}from"./stores-BATHCuMN.js";import{o as E}from"./view-navigation-FdnvQSOv.js";import{n as D}from"./Toaster-D76T-Ld4.js";import{a as O,n as te,o as ne,r as k,t as A}from"./dialog-CfAoIH8P.js";import{t as j}from"./button-ELs5xgtQ.js";import{t as M}from"./input-DSTQkMEh.js";import{D as N,a as P,b as F,i as I,r as L,t as R,x as z}from"./index-BTRQG7C5.js";var B=e(n(),1);function V(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var H=v();function re({onKeySaved:e}){let{t}=i(),[n,r]=(0,B.useState)(!1),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(`openai-compatible`),[l,f]=(0,B.useState)(``),[p,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)([]),{setFieldRef:y,handleKeyDown:b}=P(),x=async()=>{if(a.trim()){g(!0);try{let n=C(T.getState().wsUrl),i=V(n);n.send({type:`provider.add`,payload:{id:a.trim(),family:s,baseUrl:l.trim()||void 0,apiKey:p.trim()||void 0,models:_.length>0?_.map(e=>e.id):void 0,customModels:_.length>0?Object.fromEntries(_.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let c=await i;if(!c.success)throw Error(c.message);D.success(t(`setup:screen.toasts.providerAdded`,{id:a.trim()})),e(a.trim()),n.listSavedProviders(),n.probeProvider(a.trim()),o(``),f(``),m(``),v([]),r(!1)}catch(e){let n=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;D.error(n??t(`setup:screen.toasts.providerAddFailed`))}finally{g(!1)}}};return(0,H.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,H.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,H.jsx)(ee,{className:`h-5 w-5 text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`flex-1`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`setup:screen.custom.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`setup:screen.custom.description`)})]}),(0,H.jsx)(u,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,n&&`rotate-90`)})]}),n&&(0,H.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:t(`setup:screen.custom.localServers`)}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,H.jsx)(j,{type:`button`,size:`sm`,variant:a===e.id?`default`:`outline`,onClick:()=>{o(e.id),c(`openai-compatible`),f(e.defaultBaseUrl),e.noAuth&&m(``),v([])},title:e.hint,children:e.label},e.id))})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.providerId`)}),(0,H.jsx)(M,{placeholder:t(`activity:customProviderSection.eGMyLlm`),value:a,onChange:e=>o(e.target.value),className:`text-sm`,ref:y(0),onKeyDown:e=>b(e,0)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.family`)}),(0,H.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:y(1),onKeyDown:e=>b(e,1),children:[(0,H.jsx)(`option`,{value:`openai-compatible`,children:t(`setup:screen.custom.familyOpenAiCompatible`)}),(0,H.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,H.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,H.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.baseUrl`)}),(0,H.jsx)(M,{placeholder:t(`activity:customProviderSection.eGHttpLocalhost11434V1`),value:l,onChange:e=>f(e.target.value),className:`text-sm font-mono`,ref:y(2),onKeyDown:e=>b(e,2)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:t(`setup:screen.custom.apiKey`)}),(0,H.jsx)(M,{type:`password`,placeholder:t(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>m(e.target.value),className:`text-sm font-mono`,ref:y(3),onKeyDown:e=>b(e,3)})]}),(0,H.jsx)(R,{models:_,onChange:v}),(0,H.jsxs)(j,{onClick:x,disabled:!a.trim()||h,size:`sm`,ref:y(4),onKeyDown:e=>b(e,4,x),children:[h?(0,H.jsx)(d,{className:`h-4 w-4 animate-spin mr-2`}):null,t(`setup:screen.custom.add`)]})]})]})}var U=I();async function ie(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:U}catch{return U}}function ae(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var oe=e(y(),1);function se({popular:e,catalogProvider:n,savedProvider:o,onKeySaved:s,probeResult:c}){let{t:l}=i(),[f,p]=(0,B.useState)(``),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(!!o?.apiKeys.some(e=>e.isActive)),[x,ee]=(0,B.useState)(!1),[S,E]=(0,B.useState)(!1),[N,P]=(0,B.useState)(!1),[F,I]=(0,B.useState)(null);(0,B.useEffect)(()=>{N&&e.referral&&oe.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>I(e)).catch(()=>I(null))},[N,e.referral]);let L=async()=>{if(f.trim()){v(!0);try{let t=C(T.getState().wsUrl),r=V(t);n?t.addKey(e.id,`default`,f.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:f.trim()}});let i=await r;if(!i.success)throw Error(i.message);b(!0),p(``),D.success(l(`setup:screen.toasts.keySaved`,{name:e.name})),s(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;D.error(n??l(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{v(!1)}}},R=e=>{e.key===`Enter`&&f.trim()&&L()},z=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),E(!0),D.success(l(`setup:screen.toasts.referralCopied`)),setTimeout(()=>E(!1),2e3)}catch{D.error(l(`setup:screen.toasts.referralCopyFailed`))}},re=n&&n.modelCount>0;return(0,H.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,y?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,H.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),y&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,H.jsx)(m,{className:`h-2.5 w-2.5`}),l(`setup:screen.card.keySaved`)]}),e.referral&&!y&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,H.jsx)(a,{className:`h-2.5 w-2.5`}),l(`setup:screen.card.referral`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!y&&(0,H.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),y?y?(0,H.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[o?.baseUrl&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:o.baseUrl,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[l(`activity:providerKey.url`),` `]}),o.baseUrl]}),o?.models&&o.models.length>0&&(0,H.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[l(`activity:providerKey.models`),` `]}),o.pickedModelId??o.models[0],(0,H.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,o.models.length-1,` more)`]})]}),c===`probing`?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,H.jsx)(d,{className:`h-3 w-3 animate-spin`}),l(`setup:screen.probe.checking`,`Checking connection…`)]}):c?.ok?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,H.jsx)(m,{className:`h-3 w-3`}),(0,H.jsxs)(`span`,{children:[l(`setup:screen.probe.connected`,`Connected`),c.modelCount!=null&&` · ${c.modelCount} ${l(`setup:screen.probe.models`,`models`)}`,c.elapsedMs!=null&&` · ${c.elapsedMs}ms`]})]}):c&&!c.ok?(0,H.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,H.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:l(`setup:screen.probe.failed`,`Probe failed`)}),c.status===`no_base_url`&&(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:l(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),c.status===`unreachable`&&(0,H.jsxs)(`span`,{className:`block text-destructive/70`,children:[l(`setup:screen.probe.unreachable`,`Could not connect`),c.detail?`: ${c.detail}`:``]}),c.status!==`no_base_url`&&c.status!==`unreachable`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`block text-destructive/70`,children:c.httpStatus==null?c.status:`${l(`setup:screen.probe.httpStatus`,`Status`)} ${c.httpStatus}`}),c.detail&&(0,H.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:c.detail,children:c.detail})]})]})]}):null,re&&(0,H.jsxs)(`button`,{type:`button`,onClick:()=>ee(!x),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[l(`setup:screen.providers.modelsAvailable`,{count:n?.modelCount??0}),x?(0,H.jsx)(t,{className:`h-3 w-3`}):(0,H.jsx)(u,{className:`h-3 w-3`})]})]}):null:(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(M,{type:`password`,placeholder:e.keyPlaceholder,value:f,onChange:e=>p(e.target.value),onKeyDown:R,className:`font-mono text-sm`}),(0,H.jsx)(j,{onClick:L,disabled:!f.trim()||_,size:`sm`,className:`shrink-0`,children:_?(0,H.jsx)(d,{className:`h-4 w-4 animate-spin`}):l(`setup:screen.card.save`)})]}),e.docsUrl&&(0,H.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[l(`setup:screen.card.getKey`),` `,(0,H.jsx)(g,{className:`h-3 w-3`})]}),e.referral&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:S?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(m,{className:`h-3 w-3`}),` `,l(`setup:screen.card.copied`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(r,{className:`h-3 w-3`}),` `,l(`setup:screen.card.copyReferral`)]})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>P(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,H.jsx)(h,{className:`h-3 w-3`}),` `,l(`setup:screen.card.share`)]})]})]})]})]}),(0,H.jsx)(A,{open:N,onOpenChange:P,children:(0,H.jsxs)(te,{className:`sm:max-w-md`,children:[(0,H.jsxs)(O,{children:[(0,H.jsxs)(ne,{className:`flex items-center gap-2`,children:[(0,H.jsx)(a,{className:`h-4 w-4 text-warning`}),l(`setup:screen.share.title`,{name:e.name})]}),(0,H.jsx)(k,{children:l(`setup:screen.share.description`)})]}),(0,H.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`text-sm text-center`,children:(0,H.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),F?(0,H.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,H.jsx)(`img`,{src:F,alt:l(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,H.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,H.jsx)(d,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,H.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.twitter`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.linkedin`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),l(`activity:providerKey.linkedin`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.telegram`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),l(`activity:providerKey.telegram`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.whatsapp`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),l(`activity:providerKey.whatsapp`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.reddit`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),l(`activity:providerKey.reddit`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}&quote=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:l(`setup:screen.share.facebook`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),l(`activity:providerKey.facebook`)]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:l(`setup:screen.share.email`),children:[(0,H.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,H.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),l(`activity:providerKey.email`)]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(M,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,H.jsx)(j,{size:`sm`,variant:`outline`,onClick:z,className:`shrink-0`,children:S?(0,H.jsx)(m,{className:`h-4 w-4`}):(0,H.jsx)(r,{className:`h-4 w-4`})})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:l(`setup:screen.share.hint`)})]})]})})]})})]})}function W(){let{t:e}=i(),{model:t,setProvider:n,setModel:r,wsConnected:a,wsUrl:h}=T(s(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));S();let[g,v]=(0,B.useState)([]),[y,ee]=(0,B.useState)({}),[O,te]=(0,B.useState)([]),[ne,k]=(0,B.useState)(!1),[A,M]=(0,B.useState)(null),[P,I]=(0,B.useState)(0),[L,R]=(0,B.useState)(new Set),[V,oe]=(0,B.useState)({}),[W,ce]=(0,B.useState)(U),[G,K]=(0,B.useState)(!1),[le,ue]=(0,B.useState)(0),[de,fe]=(0,B.useState)(0),[q,pe]=(0,B.useState)(null),J=(0,B.useRef)(!0);(0,B.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return K(!0),ie(t,e.signal).then(t=>{if(t!==U){if(ce(t),K(!1),!J.current){let e=t.length-de;e>0?D.success(c.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?D.success(c.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):D.success(c.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),fe(t.length)}pe(new Date);return}return ie(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(ce(e),!J.current){let t=e.length-de;t>0?D.success(c.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?D.success(c.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):D.success(c.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),fe(e.length)}pe(new Date)}}).catch(()=>{J.current||D.error(c.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{K(!1),J.current=!1}),()=>e.abort()},[le]);let[Y,me]=(0,B.useState)(null),[X,Z]=(0,B.useState)(null),[he,ge]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!a)return;let e=C(h),n=setTimeout(()=>{n=null,k(!1),M(c.t(`setup:screen.errors.backendNotResponding`))},8e3),r=()=>{n&&=(clearTimeout(n),null)},i=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){r(),M(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));v(t),k(!1)}}),o=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let n=e.payload;if(n.provider!==Y)return;ee(e=>({...e,[n.provider]:n.models})),ge(!1),n.models.length===1?Z(n.models[0].id):t&&n.models.some(e=>e.id===t)&&Z(t)}}),s=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));te(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));R(n)}}),l=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;oe(e=>({...e,[t.providerId]:t}))});return M(null),k(!0),e.listProviders(),()=>{r(),i?.(),o?.(),s?.(),l?.()}},[a,h,t,P,Y]);let _e=(0,B.useCallback)(()=>{M(null),I(e=>e+1)},[]),ve=(0,B.useCallback)(()=>{ue(e=>e+1)},[]),ye=(0,B.useCallback)(t=>ae(t,e),[e]),be=(0,B.useCallback)(e=>{R(t=>new Set([...t,e])),me(e),Z(null)},[]),xe=L.size>0;(0,B.useEffect)(()=>{if(!Y||!a)return;let e=C(h);y[Y]||(ge(!0),e.listProviderModels(Y))},[Y,a,h,y]);let Se=Y?y[Y]??[]:[],Ce=(0,B.useCallback)(async()=>{if(!Y||!X)return;if(!L.has(Y)){D.error(`Please save the provider configuration before starting a session.`);return}n(Y),r(X);let e=C(h),t=await e.switchModel(Y,X,5e3);t.success?(e.newSession(),E(`chat`)):D.error(t.message||c.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,n,r,h]),we=(0,B.useCallback)(async()=>{if(!Y||!X)return;n(Y),r(X);let e=await C(h).switchModel(Y,X,5e3);e.success?E(`chat`):D.error(e.message||c.t(`setup:screen.errors.modelSwitchTimeout`))},[Y,X,n,r,h]),Te=new Set(W.map(e=>e.id)),Ee=g.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=z(Ee,10);z(O,9);let $=z(Se,12,Y);return(0,H.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,H.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,H.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&Y?(0,H.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,H.jsx)(m,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,H.jsx)(N,{className:`min-h-0 flex-1`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,H.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,H.jsx)(p,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,H.jsx)(u,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(b,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,H.jsx)(u,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,Y&&X?`text-primary font-medium`:`text-muted-foreground`),children:[(0,H.jsx)(l,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,H.jsx)(o,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),A?(0,H.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,H.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,H.jsx)(_,{className:`h-6 w-6 text-destructive`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:A})]}),(0,H.jsxs)(j,{onClick:_e,size:`sm`,variant:`outline`,children:[(0,H.jsx)(d,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[G&&(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(d,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),q&&!G&&(0,H.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:q.toLocaleString(),children:ye(q)}),(0,H.jsxs)(`button`,{type:`button`,onClick:ve,disabled:G,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,H.jsx)(x,{className:w(`h-3 w-3`,G&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:W.map(e=>(0,H.jsx)(se,{popular:e,catalogProvider:g.find(t=>t.id===e.id),savedProvider:O.find(t=>t.id===e.id),onKeySaved:be,probeResult:V[e.id]},e.id))})]}),Ee.length>0&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,H.jsx)(se,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:O.find(e=>e.id===t.id),onKeySaved:be,probeResult:V[t.id]},t.id))}),(0,H.jsx)(F,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,H.jsx)(re,{onKeySaved:be})]})]}),ne&&(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(d,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),Y&&(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,H.jsx)(l,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{me(null),Z(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:Y})}),he?(0,H.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,H.jsx)(d,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,H.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>Z(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,X===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,H.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),X===e.id&&(0,H.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,H.jsx)(m,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,H.jsx)(F,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),Y&&X&&(0,H.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Y,` / `,X]})}),(0,H.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,H.jsxs)(j,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(b,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,H.jsx)(f,{className:`h-4 w-4 ml-2`})]}),(0,H.jsxs)(j,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,H.jsx)(m,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,H.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{W as SetupScreen};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-GiKfK4Iw.js","assets/rolldown-runtime-QTnfLwEv.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Ci as n,Fa as r,Gr as ee,Mn as te,On as ne,Qi as re,Ra as i,Wt as ie,Zi as a,Zr as ae,_a as o,_i as oe,ar as s,dt as c,ea as se,fa as ce,jr as le,jt as l,lt as u,vn as ue}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{s as d}from"./monaco-BLUV5g0U.js";import{t as de}from"./useWebSocket-B2opfRwA.js";import{t as f}from"./utils-CUCQrODG.js";import{n as p}from"./ui-store-BGNdg1e4.js";import{o as fe}from"./view-navigation-FdnvQSOv.js";import{a as pe,n as me,o as he,t as ge}from"./dialog-CfAoIH8P.js";import{p as m}from"./markdown-sSmz-Ua_.js";import{c as _e,g as h,u as g}from"./index-BTRQG7C5.js";import{t as ve}from"./empty-state-BDwjdvMh.js";var _=e(t(),1),v=u(),ye=(0,_.lazy)(()=>d(()=>import(`./vendor-GiKfK4Iw.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function y(e){return e===`project`||e===`user`}function be(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function xe({source:e}){let{t}=r(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,v.jsx)(`span`,{className:f(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`border-success/25 bg-success/8 text-success`,n===`user`&&`border-primary/25 bg-primary/10 text-primary`,n===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function b({className:e}){let{t}=r(),{client:u}=de(),d=p(e=>e.skillsState),b=p(e=>e.setSkillsState),x=d.selectedSkill,S=d.navHistory,C=d.historyIndex,[w,Se]=(0,_.useState)(null),[Ce,T]=(0,_.useState)(!1),[we,E]=(0,_.useState)(null),Te=_e(`skill-detail`,!!w),[D,O]=(0,_.useState)(!1),[k,A]=(0,_.useState)(``),[j,Ee]=(0,_.useState)(!1),[De,M]=(0,_.useState)(null),[N,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(!1),z=(0,_.useRef)(``),[B,V]=(0,_.useState)(!1),[H,U]=(0,_.useState)(null),[Oe,W]=(0,_.useState)(!1),[G,K]=(0,_.useState)(null),[q,ke]=(0,_.useState)(!1),[Ae,je]=(0,_.useState)([]),J=(0,_.useRef)(d);J.current=d;let Y=(0,_.useRef)(!1),X=(0,_.useMemo)(()=>k?{lines:k.split(`
3
+ `).length,words:k.trim()?k.trim().split(/\s+/).length:0,chars:k.length}:{lines:0,words:0,chars:0},[k]),Z=(0,_.useMemo)(()=>{if(!k)return null;let e=5*1024*1024,t=new Blob([k]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[k]);(0,_.useEffect)(()=>{if(!F)return;let e=setTimeout(()=>I(null),2e3);return()=>clearTimeout(e)},[F]),(0,_.useEffect)(()=>{if(!D||!x)return;let e=setInterval(()=>{k&&k!==z.current&&(z.current=k,localStorage.setItem(`skills_draft_${x.name}`,JSON.stringify({content:k,savedAt:Date.now()})),I(Date.now()))},5e3);return()=>clearInterval(e)},[D,k,x]),(0,_.useEffect)(()=>{if(!x||!D)return;let e=localStorage.getItem(`skills_draft_${x.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==k&&t!==z.current&&(A(t),z.current=t,R(!0))}catch{}},[x?.name,D]),(0,_.useEffect)(()=>{if(!u||!x)return;T(!0),Se(null),E(null);let e=setTimeout(()=>{T(!1),E(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?E(n.payload.error):n.payload.name&&Se(n.payload),T(!1)},n=e=>{let t=e;V(!1);let n=J.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;b({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),u.send({type:`skills.list`},{echoToChat:!1})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&je(t.payload.skills)};return u.on(`skills.content`,t),u.on(`skills.updated`,n),u.on(`skills.list`,r),u.send({type:`skills.content`,payload:{name:x.name,source:x.source}}),()=>{clearTimeout(e),u.off(`skills.content`,t),u.off(`skills.updated`,n),u.off(`skills.list`,r)}},[u,x?.name,x?.source]),(0,_.useEffect)(()=>{D&&(O(!1),A(``),M(null))},[x?.name]);let Q=(0,_.useCallback)(e=>Ae.find(t=>t.name.toLowerCase()===e.toLowerCase()),[Ae]),Me=(0,_.useCallback)(e=>{let t=Q(e);if(t){Y.current=!1;let e=S.slice(0,C+1);e.push(t),b({...J.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),O(!1),A(``),U(null)}},[Q,S,C,b]),Ne=(0,_.useCallback)(()=>{if(C<=0)return;Y.current=!0;let e=C-1,t=S[e];b({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),U(null)},[C,S,b]),Pe=(0,_.useCallback)(()=>{if(C>=S.length-1)return;Y.current=!0;let e=C+1,t=S[e];b({...J.current,selectedSkill:t,historyIndex:e}),O(!1),A(``),U(null)},[C,S,b]),$=(0,_.useCallback)(()=>{fe(`chat`)},[]),Fe=(0,_.useCallback)(()=>{w&&(A(w.body),z.current=w.body,R(!1),M(null),O(!0),P(!1))},[w]),Ie=(0,_.useCallback)(()=>{O(!1),A(``),M(null),P(!1),R(!1),x&&localStorage.removeItem(`skills_draft_${x.name}`)},[x]),Le=(0,_.useCallback)(()=>{!x||!w||(R(!1),A(w.body),z.current=w.body,x&&localStorage.removeItem(`skills_draft_${x.name}`))},[x,w]),Re=(0,_.useCallback)(()=>{if(!u||!x||!k.trim())return;Ee(!0),M(null);let e=t=>{let n=t;Ee(!1),n.payload.success?(z.current=``,localStorage.removeItem(`skills_draft_${x.name}`),R(!1),O(!1),u.send({type:`skills.content`,payload:{name:x.name,source:x.source}}),u.send({type:`skills.list`},{echoToChat:!1})):M(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),u.off(`skills.edited`,e)};u.on(`skills.edited`,e),u.editSkill(x.name,k)},[u,x,k]),ze=(0,_.useCallback)(()=>{!u||!x||(V(!0),U(null),u.checkForUpdates(x.name,x.source===`user`))},[u,x]),Be=(0,_.useCallback)(()=>{x?.sourceUrl&&navigator.clipboard.writeText(x.sourceUrl).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)})},[x]),Ve=(0,_.useCallback)(()=>{if(!w?.body)return;let e=new Blob([w.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${w.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[w]),He=(0,_.useCallback)(async e=>{if(!u||!e)return;ke(!0);let t=e=>{let n=e;ke(!1),n.payload.success?(K(null),u.send({type:`skills.list`},{echoToChat:!1}),$()):M(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),u.off(`skills.uninstalled`,t)};u.on(`skills.uninstalled`,t),u.uninstallSkill(e.name,e.source===`user`)},[u,$]);return x?(0,v.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,v.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,v.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,v.jsx)(ie,{className:`h-4 w-4`})}),(0,v.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:x.name}),x.version&&(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,x.version]}),(0,v.jsx)(xe,{source:x.source})]}),(0,v.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:x.description||x.trigger}),x.sourceUrl&&(0,v.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,v.jsxs)(`a`,{href:`https://${x.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:t(`activity:skillDetail.openSourceRepo`),children:[(0,v.jsx)(le,{className:`h-3 w-3 shrink-0`}),(0,v.jsx)(`span`,{className:`truncate font-mono`,children:x.sourceUrl})]}),(0,v.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:t(`activity:skillDetail.copySourceUrl`),children:Oe?(0,v.jsx)(se,{className:`h-3 w-3 text-success`}):(0,v.jsx)(n,{className:`h-3 w-3`})})]}),x.scope.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:x.scope.map(e=>(0,v.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,v.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,v.jsx)(`div`,{className:`text-success`,children:t(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,v.jsx)(`div`,{className:`text-muted-foreground`,children:t(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,v.jsx)(`div`,{className:`text-destructive`,children:t(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[y(x.source)&&x.sourceUrl&&(0,v.jsx)(`button`,{type:`button`,onClick:ze,disabled:B,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:t(`activity:skillDetail.checkUpdatesTitle`),children:B?(0,v.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,v.jsx)(ue,{className:`h-3.5 w-3.5`})}),x.source!==`bundled`&&!D&&(0,v.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:t(`activity:skillDetail.exportTitle`),children:(0,v.jsx)(oe,{className:`h-3.5 w-3.5`})}),y(x.source)&&!D&&(0,v.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:t(`activity:skillDetail.editTitle`),children:(0,v.jsx)(ne,{className:`h-3.5 w-3.5`})}),y(x.source)&&(0,v.jsx)(`button`,{type:`button`,onClick:()=>K(x),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:t(`activity:skillDetail.uninstallTitle`),children:(0,v.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,v.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:t(`activity:skillDetail.closeTitle`),children:(0,v.jsx)(c,{className:`h-4 w-4`})})]})]}),S.length>1&&(0,v.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:Ne,disabled:C<=0,className:f(`rounded p-1 transition-colors`,C<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:t(`activity:skillDetail.backTitle`),children:(0,v.jsx)(re,{className:`h-4 w-4`})}),(0,v.jsx)(`button`,{type:`button`,onClick:Pe,disabled:C>=S.length-1,className:f(`rounded p-1 transition-colors`,C>=S.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:t(`activity:skillDetail.forwardTitle`),children:(0,v.jsx)(a,{className:`h-4 w-4`})}),(0,v.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:S.map((e,t)=>(0,v.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[t>0&&(0,v.jsx)(a,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>{t<C&&(Y.current=!0,b({...J.current,selectedSkill:e,historyIndex:t}),O(!1),A(``),U(null))},className:f(`hover:text-primary cursor-pointer transition-colors`,t===C?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+t))})]})]}),w&&(w.relatedFiles.length>0||w.references.length>0)&&(0,v.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[w.relatedFiles.length>0&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,v.jsx)(ee,{className:`h-3 w-3`}),(0,v.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:t(`activity:skillDetail.relatedFiles`)})]}),w.relatedFiles.map(e=>{let n=be(e);return n&&Q(n)?(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Me(n),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:t(`activity:skillDetail.goToSkillTitle`,{name:n}),children:[(0,v.jsx)(o,{className:`h-2.5 w-2.5`}),e]},e):(0,v.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),w.references.length>0&&(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,v.jsx)(ae,{className:`h-3 w-3`}),(0,v.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:t(`activity:skillDetail.references`)})]}),w.references.map(e=>{let n=be(e)??e.replace(/\.md$/,``);return Q(n)?(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Me(n),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:t(`activity:skillDetail.goToSkillTitle`,{name:n}),children:[(0,v.jsx)(o,{className:`h-2.5 w-2.5`}),n]},e):(0,v.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:n},e)})]})]}),(0,v.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:Ce?(0,v.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,v.jsx)(s,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,v.jsx)(`p`,{children:t(`activity:skillDetail.loadingContent`)})]}):D?(0,v.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:skillDetail.editingLabel`,{name:x.name})}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t(`activity:skillDetail.editStats`,{lines:X.lines,words:X.words,chars:X.chars})}),Z&&(0,v.jsx)(`span`,{className:`text-xs tabular-nums ${Z.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:t(`activity:skillDetail.charsWarningFmt`,{used:(Z.used/(1024*1024)).toFixed(1),limit:(Z.limit/(1024*1024)).toFixed(0)})}),F&&(0,v.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:t(`activity:skillDetail.draftSaved`)}),L&&(0,v.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:t(`activity:skillDetail.draftRestored`)})]}),(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[De&&(0,v.jsx)(`span`,{className:`text-xs text-destructive`,children:De}),L&&(0,v.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:t(`activity:skillDetail.discardDraft`)}),(0,v.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:t(`common:action.cancel`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>P(e=>!e),title:t(N?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${N?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,v.jsx)(te,{className:`h-3 w-3 inline`})}),(0,v.jsx)(`button`,{type:`button`,onClick:Re,disabled:j||!k.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:j?(0,v.jsx)(s,{className:`h-3 w-3 animate-spin inline`}):t(`common:action.save`)})]})]}),N?(0,v.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,v.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,v.jsx)(_.Suspense,{fallback:null,children:(0,v.jsx)(ye,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:t(`activity:skillDetail.contentPlaceholder`)})})}),(0,v.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,v.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,v.jsx)(g,{rehypePlugins:[m],components:h,children:k})})]}):(0,v.jsx)(_.Suspense,{fallback:null,children:(0,v.jsx)(ye,{value:k,onChange:e=>A(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:t(`activity:skillDetail.contentPlaceholder`)})})]}):w?(0,v.jsx)(`div`,{ref:Te,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,v.jsx)(g,{rehypePlugins:[m],components:h,children:w.body})}):we?(0,v.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,v.jsx)(`p`,{className:`text-destructive mb-2`,children:t(`activity:skillDetail.loadFailed`)}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:we}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>{u&&x&&(T(!0),E(null),u.send({type:`skills.content`,payload:{name:x.name,source:x.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:t(`common:action.retry`)})]}):(0,v.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:t(`activity:skillDetail.noContent`)})}),(0,v.jsx)(ge,{open:!!G,onOpenChange:e=>{e||K(null)},children:(0,v.jsxs)(me,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,v.jsxs)(pe,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(l,{className:`h-4 w-4 text-destructive`}),(0,v.jsx)(he,{className:`font-semibold text-sm`,children:t(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>K(null),"aria-label":t(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,v.jsx)(c,{className:`h-4 w-4`})})]}),(0,v.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,v.jsx)(`p`,{className:`text-sm`,children:G&&t(`activity:skillDetail.uninstallConfirm`,{name:G.name})}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:G&&t(`activity:skillDetail.uninstallRemovePath`,{path:G.path})})]}),(0,v.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>K(null),disabled:q,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:t(`common:action.cancel`)}),(0,v.jsxs)(`button`,{type:`button`,onClick:()=>G&&He(G),disabled:q,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[q&&(0,v.jsx)(s,{className:`h-3 w-3 animate-spin`}),t(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,v.jsx)(ve,{icon:(0,v.jsx)(ce,{className:`h-6 w-6`}),title:t(`activity:skillDetail.noSkillSelected`),description:t(`activity:skillDetail.selectSkillHint`),action:{label:t(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{b as SkillDetailView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Fi as n,Ii as r,Pa as i,Qi as a,Wi as o,Xi as s,Xr as c,dt as l,ir as u,lt as d,ma as f,mn as p,mr as m,nr as h,wn as g,za as _,zn as v}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as y}from"./useWebSocket-CZSpbA3M.js";import{t as b}from"./utils-B-9lSDIn.js";import{a as x}from"./stores-vuG0AaKy.js";import{r as S}from"./view-navigation-DIDEcp4V.js";import{t as C}from"./button-Dcy288Mc.js";var w=e(_(),1),T=d(),E={completed:{icon:(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(t,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:n}=i();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(s,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:a}=i();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:a(r.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(u,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:t}){let{client:n}=y(),{t:r}=i(),o=x(e=>e.specs),u=x(e=>e.detail),d=x(e=>e.expandedSpecId),f=x(e=>e.setExpanded),[p,h]=(0,w.useState)(`graph`),_=(0,w.useCallback)(e=>{!u||u.specId!==e.id||(n?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(u),autonomous:!0}}),S(`goal`))},[u,n]),E=(0,w.useCallback)(e=>{let r=e.graphId??(u?.specId===e.id?u.graphId:void 0);r?n?.send?.({type:`sdd.run.from_graph`,payload:{graphId:r,worktrees:!0}}):n?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),S(`sddhub`)},[u,n,t]);(0,w.useEffect)(()=>{n?.send?.({type:`specs.list`})},[n]);let D=(0,w.useCallback)(e=>{d===e.id?f(null):(f(e.id),n?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[d,f,n]),O=u?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(c,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:r(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(l,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:o.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:o.map(e=>{let t=d===e.id,n=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(a,{className:`h-4 w-4`}):(0,T.jsx)(s,{className:`h-4 w-4`})}),(0,T.jsx)(c,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${n}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[r(`activity:specs.tasks`,{count:u?.total??e.total}),u&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:r(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:r(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:r(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:r(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!u||u.specId!==e.id,onClick:()=>_(e),title:r(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.graph`)]})]})]})]}),!u||u.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.loadingTasks`)}):p===`graph`?(0,T.jsx)(k,{columns:u.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ba as n,Bn as r,Fa as i,Gi as a,Ii as o,Li as s,Tn as c,Zi as l,Zr as u,ar as d,dt as f,ha as p,hr as m,ji as h,lt as g,mn as _,rr as v}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as y}from"./useWebSocket-B2opfRwA.js";import{t as b}from"./utils-CUCQrODG.js";import{a as x}from"./stores-BATHCuMN.js";import{r as S}from"./view-navigation-FdnvQSOv.js";import{t as C}from"./button-ELs5xgtQ.js";var w=e(n(),1),T=g(),E={completed:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(o,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:n}=i();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(l,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:a}=i();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:a(r.labelKey)})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(d,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:n}){let{client:a}=y(),{t:o}=i(),s=x(e=>e.specs),d=x(e=>e.detail),p=x(e=>e.expandedSpecId),h=x(e=>e.setExpanded),[g,_]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!d||d.specId!==e.id||(a?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(d),autonomous:!0}}),S(`goal`))},[d,a]),E=(0,w.useCallback)(e=>{let t=e.graphId??(d?.specId===e.id?d.graphId:void 0);t?a?.send?.({type:`sdd.run.from_graph`,payload:{graphId:t,worktrees:!0}}):a?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),n?.(),S(`sddhub`)},[d,a,n]);(0,w.useEffect)(()=>{a?.send?.({type:`specs.list`})},[a]);let D=(0,w.useCallback)(e=>{p===e.id?h(null):(h(e.id),a?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[p,h,a]),O=d?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:o(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(f,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:s.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:o(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:s.map(e=>{let n=p===e.id,i=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:n?(0,T.jsx)(t,{className:`h-4 w-4`}):(0,T.jsx)(l,{className:`h-4 w-4`})}),(0,T.jsx)(u,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${i}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),n&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[o(`activity:specs.tasks`,{count:d?.total??e.total}),d&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:o(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:o(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:o(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:o(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!d||d.specId!==e.id,onClick:()=>v(e),title:o(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>_(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,g===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(r,{className:`h-3.5 w-3.5`}),` `,o(`activity:specs.graph`)]})]})]})]}),!d||d.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:o(`activity:specs.loadingTasks`)}):g===`graph`?(0,T.jsx)(k,{columns:d.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};