@wrongstack/webui 0.300.0 → 0.302.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 (130) hide show
  1. package/dist/assets/AgentRosterView-PafACoYi.js +9 -0
  2. package/dist/assets/{AnalyticsDashboard-CIN35A_u.js → AnalyticsDashboard-D5lvkaiF.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-BAY2Bh8z.js → AudienceMemoryPanel-DUXllPor.js} +1 -1
  4. package/dist/assets/{ChangesView-CVWSTGmX.js → ChangesView-CKLN6MLR.js} +1 -1
  5. package/dist/assets/ChronicleDashboard-B8OyHq18.js +1 -0
  6. package/dist/assets/{CodeEditor-CWY_6cQD.js → CodeEditor-BtAkdKFs.js} +1 -1
  7. package/dist/assets/{CodeMap-CjmKO0lB.js → CodeMap-6L-z-L7d.js} +1 -1
  8. package/dist/assets/ConfirmModal-B0BCqW4j.js +1 -0
  9. package/dist/assets/{CronJobsPanel-BinzTWNs.js → CronJobsPanel-B-rRYNgE.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-C3CgaNVv.js → DeadCodeScanPanel-CDbBO9Ic.js} +1 -1
  11. package/dist/assets/{DebugDashboard-BqUghn06.js → DebugDashboard-RAxaJDNV.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-CuWWQAlD.js → DesignGalleryView-4kdGN1D5.js} +1 -1
  13. package/dist/assets/GoalView-By18NfaK.js +1 -0
  14. package/dist/assets/KanbanView-dyfUjpC5.js +3 -0
  15. package/dist/assets/{MailboxDetailView-aaHx9Nma.js → MailboxDetailView-BNyJNz-3.js} +1 -1
  16. package/dist/assets/{MemoryManager-BgcicCyg.js → MemoryManager-BbZ-1pfr.js} +1 -1
  17. package/dist/assets/{ModelPicker-B3BqjJnT.js → ModelPicker-DwNrO_jw.js} +1 -1
  18. package/dist/assets/{OfficeMapPanel-Ck8NUOEs.js → OfficeMapPanel-Bo-cCLV7.js} +2 -2
  19. package/dist/assets/{OfficeMapPanel-CpexsBed.css → OfficeMapPanel-D6yTfGIT.css} +1 -1
  20. package/dist/assets/{ProcessMonitor-CoMYZcdS.js → ProcessMonitor-DPEMjjVq.js} +1 -1
  21. package/dist/assets/{QueuePanel-CA3CVCO_.js → QueuePanel-Dx9n4NZB.js} +1 -1
  22. package/dist/assets/{RefreshDebugView-cqBtyNna.js → RefreshDebugView-On6-vb92.js} +1 -1
  23. package/dist/assets/{RequirementIntakeView-BBtUk8mC.js → RequirementIntakeView-DpnZRVDz.js} +1 -1
  24. package/dist/assets/SageTabs-D5CzIKGe.js +2 -0
  25. package/dist/assets/SddHub-BMedBDDs.js +2 -0
  26. package/dist/assets/{SessionInspectView-DHC_xTzG.js → SessionInspectView-Crs1g_xM.js} +1 -1
  27. package/dist/assets/SessionList-SsEjoeJF.js +1 -0
  28. package/dist/assets/SessionsDashboard-DYw9vuIv.js +1 -0
  29. package/dist/assets/SetupScreen-Mr604Nx3.js +1 -0
  30. package/dist/assets/{SkillDetailView-D7wSJWUX.js → SkillDetailView-gt-Nm_ZI.js} +1 -1
  31. package/dist/assets/{SpecsView-BRWSI1iV.js → SpecsView-CVVQSIZZ.js} +1 -1
  32. package/dist/assets/{TechStackView-BOjkuJLe.js → TechStackView-BNen0ZpH.js} +1 -1
  33. package/dist/assets/{TerminalPanel-Dg8WR5Un.js → TerminalPanel-BByD75cu.js} +1 -1
  34. package/dist/assets/{Toaster-DSKFSuK3.js → Toaster-Cz-_rtgo.js} +1 -1
  35. package/dist/assets/activity-B0cam54R.js +9 -0
  36. package/dist/assets/activity-B3FDXYFE.js +9 -0
  37. package/dist/assets/activity-D7dMY0Jm.js +9 -0
  38. package/dist/assets/{activity-Bjb_mil3.js → activity-DXNwLcwn.js} +4 -4
  39. package/dist/assets/activity-DmdoxMAj.js +9 -0
  40. package/dist/assets/{activity-BWbV0byu.js → activity-IZoezahu.js} +4 -4
  41. package/dist/assets/{activity-Ciqcr7Ps.js → activity-jOHsoosT.js} +4 -4
  42. package/dist/assets/chat-BPuAsrkF.js +1 -0
  43. package/dist/assets/chat-BfQBSiII.js +1 -0
  44. package/dist/assets/chat-BnkVCZ3Q.js +1 -0
  45. package/dist/assets/chat-CR2B97dj.js +1 -0
  46. package/dist/assets/chat-CdiY7G6Z.js +1 -0
  47. package/dist/assets/chat-DResBrkV.js +1 -0
  48. package/dist/assets/chat-Di8o0wDz.js +1 -0
  49. package/dist/assets/chat-store-DbxFVDwi.js +17 -0
  50. package/dist/assets/i18n-ags7mYPP.js +2 -0
  51. package/dist/assets/index-Cw20Xg0d.css +1 -0
  52. package/dist/assets/index-Doa2aJ1A.js +132 -0
  53. package/dist/assets/mailbox-store-C1mzoSqJ.js +1 -0
  54. package/dist/assets/{progress-ring-D_d6hn_4.js → progress-ring-BxJsZCnD.js} +1 -1
  55. package/dist/assets/{roster-ws-D6dGRfC5.js → roster-ws-Da57e_sI.js} +1 -1
  56. package/dist/assets/session-store-Df7_hhe9.js +1 -0
  57. package/dist/assets/settings-Bb7_utQE.js +1 -0
  58. package/dist/assets/settings-Bd8zMwvC.js +1 -0
  59. package/dist/assets/settings-DdFgBMAw.js +1 -0
  60. package/dist/assets/settings-De6sXIFO.js +1 -0
  61. package/dist/assets/settings-E8SKMLxq.js +1 -0
  62. package/dist/assets/settings-zIY9-ivF.js +1 -0
  63. package/dist/assets/settings-zKBcRjqE.js +1 -0
  64. package/dist/assets/stores-Bz5nhi7q.js +7 -0
  65. package/dist/assets/{useWebSocket-DuLtH2jI.js → useWebSocket-BHzEXXna.js} +7 -7
  66. package/dist/assets/ws-client-TTMa0XaT.js +1 -0
  67. package/dist/components/AgentCard.d.ts +21 -0
  68. package/dist/components/AgentsPage.d.ts +0 -3
  69. package/dist/components/ChatInput/refine-panel-host.d.ts +2 -2
  70. package/dist/components/ConfirmModal.d.ts +7 -2
  71. package/dist/components/KanbanBoardState.d.ts +1 -2
  72. package/dist/components/KanbanTaskInspector.d.ts +1 -2
  73. package/dist/components/SettingsPanel/ShadowSection.d.ts +18 -1
  74. package/dist/components/SettingsPanel/brain-section-options.d.ts +2 -0
  75. package/dist/components/index.d.ts +0 -1
  76. package/dist/hooks/useWebSocket.d.ts +10 -2
  77. package/dist/index.css +32 -0
  78. package/dist/index.html +15 -14
  79. package/dist/index.js +3540 -3062
  80. package/dist/lib/kanban-board-active.d.ts +19 -0
  81. package/dist/lib/kanban-cleaner.d.ts +7 -1
  82. package/dist/lib/plugin-enablement.d.ts +1 -1
  83. package/dist/lib/ws-client.d.ts +21 -1
  84. package/dist/stores/fleet-store.d.ts +1 -1
  85. package/dist/stores/local-prefs.d.ts +9 -0
  86. package/dist/stores/session-store.d.ts +9 -1
  87. package/dist/stores/ui-store.d.ts +2 -0
  88. package/dist/types/brain.d.ts +2 -0
  89. package/dist/types/client-message.d.ts +7 -1
  90. package/dist/types/protocol-core.d.ts +2 -0
  91. package/dist/types/runtime.d.ts +14 -0
  92. package/dist/types/server-message.d.ts +3 -3
  93. package/package.json +8 -8
  94. package/dist/assets/AgentRosterView-wkALMOGD.js +0 -9
  95. package/dist/assets/ChronicleDashboard-Bg3W7C9U.js +0 -1
  96. package/dist/assets/GoalView-2weuLiPM.js +0 -1
  97. package/dist/assets/KanbanView-DXYRrshJ.js +0 -3
  98. package/dist/assets/SageTabs-Di49i4Yu.js +0 -2
  99. package/dist/assets/SddHub-D8iV6l9A.js +0 -2
  100. package/dist/assets/SessionList-DH-ZsHmv.js +0 -1
  101. package/dist/assets/SessionsDashboard-Coi6htwg.js +0 -1
  102. package/dist/assets/SetupScreen-CD2Sx4n9.js +0 -1
  103. package/dist/assets/activity-Bze6njDy.js +0 -9
  104. package/dist/assets/activity-DA9hmVZV.js +0 -9
  105. package/dist/assets/activity-GdnS66AB.js +0 -9
  106. package/dist/assets/activity-eawh_OWs.js +0 -9
  107. package/dist/assets/chat-4NEOESoU.js +0 -1
  108. package/dist/assets/chat-BSg62iwX.js +0 -1
  109. package/dist/assets/chat-Bb1TpPfJ.js +0 -1
  110. package/dist/assets/chat-COLKjtcx.js +0 -1
  111. package/dist/assets/chat-CfRKV9iX.js +0 -1
  112. package/dist/assets/chat-EbeT4kiS.js +0 -1
  113. package/dist/assets/chat-store-CtOyUCdF.js +0 -17
  114. package/dist/assets/chat-ux_gymOJ.js +0 -1
  115. package/dist/assets/i18n-C31PI0Up.js +0 -2
  116. package/dist/assets/index-5IWUhPO4.css +0 -1
  117. package/dist/assets/index-D1izXztg.js +0 -132
  118. package/dist/assets/mailbox-store-Bc9ER3Ph.js +0 -1
  119. package/dist/assets/session-store-b2KGFwkX.js +0 -1
  120. package/dist/assets/settings-BKuhxUSF.js +0 -1
  121. package/dist/assets/settings-CeK0doV7.js +0 -1
  122. package/dist/assets/settings-DZ-H89lu.js +0 -1
  123. package/dist/assets/settings-DvrdpSdA.js +0 -1
  124. package/dist/assets/settings-SBUqq0ll.js +0 -1
  125. package/dist/assets/settings-W8t1ZrxM.js +0 -1
  126. package/dist/assets/settings-tOqZkk9R.js +0 -1
  127. package/dist/assets/stores-OBoFiAKe.js +0 -7
  128. package/dist/assets/ws-client-Bw1ixxwI.js +0 -1
  129. package/dist/components/AgentsMonitor.d.ts +0 -26
  130. package/dist/components/FleetMonitor.d.ts +0 -21
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Bn as n,Bt as r,Cn as i,Er as a,Gn as o,Ii as s,Ki as c,Li as l,Mt as u,Nr as d,Oa as f,Ot as p,Pa as m,Qi as h,Qt as g,Si as _,St as v,Ti as y,Ui as b,Wi as x,Wt as S,Xi as C,Xr as w,Yt as T,Zn as ee,Zt as E,an as D,ar as te,cn as O,dt as k,fn as A,gi as j,hn as ne,in as re,ir as M,ji as ie,jt as ae,kn as oe,la as se,lt as ce,mn as le,oa as ue,oi as de,qt as fe,un as pe,vi as me,vn as he,wn as N,xa as P,za as ge}from"./vendor-BuarzSSb.js";import"./i18n-C31PI0Up.js";import{t as F}from"./ws-client-Bw1ixxwI.js";import{t as I}from"./utils-B-9lSDIn.js";import{t as _e}from"./session-store-b2KGFwkX.js";import{F as ve,p as ye,w as be}from"./stores-OBoFiAKe.js";import{n as xe}from"./ui-store-CE4-TlwB.js";import{n as Se,t as Ce}from"./ModelPicker-B3BqjJnT.js";import{C as L,S as we,c as R}from"./index-D1izXztg.js";import{n as Te,t as Ee}from"./progress-ring-D_d6hn_4.js";var z=e(ge(),1);function De(e,t=!0){(0,z.useEffect)(()=>{let n=e.current;if(!n||!t)return;let r=e=>{if(!e.shiftKey||n.scrollWidth<=n.clientWidth+1)return;let t=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;t!==0&&(e.preventDefault(),n.scrollLeft+=t)},i=e=>{if(!e.ctrlKey&&!e.metaKey||n.scrollWidth<=n.clientWidth+1)return;let t=n.clientWidth*.8;e.key===`ArrowLeft`?(e.preventDefault(),n.scrollLeft-=t):e.key===`ArrowRight`&&(e.preventDefault(),n.scrollLeft+=t)};return n.addEventListener(`wheel`,r,{passive:!1}),n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`wheel`,r),n.removeEventListener(`keydown`,i)}},[e,t])}var B=4320*60*1e3,V=new Set([`completed`,`archived`]);function Oe(e,t){let n=W(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=ze(t.liveAgentIdentities),i=Pe(e,t.defaultReviewStaleAfterMs??B),a=Ne(e),o=[];for(let s of e.tasks)V.has(s.status)||(ke(o,s,t.requireDueDate===!0),Ae(o,s,n,r),je(o,s,n,i),a.length>1&&Me(o,s,a));return o.sort(Ue),{issues:o,counts:{error:o.filter(e=>e.severity===`error`).length,warning:o.filter(e=>e.severity===`warning`).length},affectedTaskCount:new Set(o.map(e=>e.taskId)).size}}function ke(e,t,n){U(t.description)||G(e,t,`missing-description`,`warning`,`Add a description`),Le(t).length===0&&G(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&&!U(t.dueDate)&&G(e,t,`missing-due-date`,`warning`,`Set a due date`),!Ve(t.labels)&&!Ve(t.tags)&&G(e,t,`missing-labels`,`warning`,`Add labels or tags`),!Ve(t.childTaskIds)&&!Ve(t.subtasks)&&G(e,t,`missing-subtasks`,`warning`,`Define subtasks`),Ve(t.successCriteria)||G(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function Ae(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=Le(t);if(!i||a.length===0||!U(i.leaseId)||!U(i.leaseExpiresAt)){G(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=W(i.leaseExpiresAt);if(o===null||o<=n){G(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}a.some(e=>r.has(H(e)))||G(e,t,`abandoned-running-task`,`error`,`Assigned agent is not live`)}function je(e,t,n,r){if(t.status!==`review`)return;let i=Ie(t,`review`)??W(t.updatedAt);i===null||n-i<=r||G(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/(3600*1e3)))}h`)}function Me(e,t,n){let r=Fe(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[H(e),t]));for(let n=1;n<r.length;n+=1){let a=r[n-1],o=r[n];if(!a||!o)continue;let s=i.get(H(a.state)),c=i.get(H(o.state));if(!(s===void 0||c===void 0||Math.abs(c-s)<=1)){G(e,t,`skipped-lifecycle-state`,`error`,`Lifecycle skipped ${a.state} → ${o.state}`);return}}}function Ne(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=Re(e);if(t.length>1)return t;if(!e||typeof e!=`object`||Array.isArray(e))continue;let n=e;if(n.mode===`managed`&&n.columns){let e=[`backlog`,`todo`,`running`,`review`,`done`].map(e=>n.columns?.[e]).filter(e=>U(e));if(e.length===5)return e}for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=Re(e);if(t.length>1)return t}}return[]}function Pe(e,t){let n=[e,e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of n){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e;if(He(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(He(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(He(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function Fe(e){let t=e.lifecycle?.history??e.lifecycleHistory??e.statusHistory??e.history;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e==`string`&&U(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=Be(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:W(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Ie(e,t){let n=null;for(let r of Fe(e))H(r.state)!==H(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function Le(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(U)}function Re(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(U(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=Be(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function ze(e){let t=new Set;if(!e)return t;for(let n of e)U(n)&&t.add(H(n));return t}function H(e){return e.trim().toLocaleLowerCase()}function Be(...e){for(let t of e)if(U(t))return t.trim();return null}function U(e){return typeof e==`string`&&e.trim().length>0}function Ve(e){return Array.isArray(e)&&e.length>0}function He(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function W(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`string`||!e.trim())return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function G(e,t,n,r,i){e.push({id:`${t.id}:${n}`,taskId:t.id,taskTitle:t.title,code:n,severity:r,message:i})}function Ue(e,t){let n=We(e.severity)-We(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function We(e){return e===`error`?0:1}function Ge(e){let t=ve(e=>e.wsUrl),n=ve(e=>e.provider),r=ve(e=>e.model),[i,a]=(0,z.useState)([]),[o,s]=(0,z.useState)([]),[c,l]=(0,z.useState)({}),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(``);return(0,z.useEffect)(()=>{let e=F(t).on(`kanban.meta`,e=>{let t=e.payload?.data;t&&(a(t.tools??[]),s(t.skills??[]),l(t.fallbackProfiles??{}),t.sessionProvider&&d(t.sessionProvider),t.sessionModel&&p(t.sessionModel))});return()=>e()},[t]),(0,z.useEffect)(()=>{e&&F(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}var K=ce();function Ke({options:e,selected:n,onChange:r,placeholder:a,emptyLabel:o}){let{t:s}=m(),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!c)return;let e=e=>{f.current&&!f.current.contains(e.target)&&l(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[c]);let p=(0,z.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),g=(0,z.useMemo)(()=>{let t=u.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,u]),_=e=>{r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,K.jsxs)(`div`,{ref:f,className:`relative`,children:[n.length>0&&(0,K.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:n.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`max-w-[150px] truncate`,children:p(e)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${p(e)}`,children:(0,K.jsx)(k,{size:11})})]},e))}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1.5 text-left text-xs transition-colors hover:border-primary/45 hover:bg-muted/80`,children:[(0,K.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:a??`Add…`}),(0,K.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),c&&(0,K.jsxs)(`div`,{className:`absolute z-50 mt-1 max-h-72 w-full min-w-[240px] overflow-hidden rounded-md border border-border/80 bg-popover shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:s(`activity:chipMultiSelect.filter`),className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),u&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>d(``),className:`text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(k,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[g.map(e=>{let r=n.includes(e.value);return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>_(e.value),className:I(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,r?`bg-primary/8 text-primary`:`text-foreground`),children:[r?(0,K.jsx)(t,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,K.jsx)(`span`,{className:`w-3 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),g.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?o??`Nothing available`:`No match`})]})]})]})}function qe(e){let t=Math.max(0,Date.now()-Date.parse(e));return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function Je(e,t){if(!e)return null;let n=Date.parse(e),r=t?Date.parse(t):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r))return null;let i=Math.max(0,Math.floor((r-n)/1e3));if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m`;let o=Math.floor(a/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function Ye({presence:e=[]}){let{t}=m();return e.length===0?null:(0,K.jsxs)(`section`,{"aria-label":t(`activity:kanban.boardPresence`),className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-card/50 px-4 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:t(`activity:kanban.liveBoardUsers`)}),e.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 text-xs shadow-sm`,title:`Session ${e.sessionId} · last seen ${e.lastSeenAt}`,children:[(0,K.jsx)(`span`,{role:`img`,"aria-label":e.active?`active`:`inactive`,className:I(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,K.jsx)(l,{size:13,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,K.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,K.jsx)(ie,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:qe(e.lastSeenAt)})]},e.id))]})}function Xe({board:e,snapshot:t,sendKanban:n}){let{t:r}=m(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!0),[c,l]=(0,z.useState)(`deterministic`),[u,d]=(0,z.useState)(`session`),[p,g]=(0,z.useState)(``),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(``),[x,S]=(0,z.useState)([]),[C,w]=(0,z.useState)([]),[T,ee]=(0,z.useState)(10),D=Se(i&&c===`agentic`),te=Ge(i&&c===`agentic`);(0,z.useEffect)(()=>{let t=e.supervisor;s(t?.enabled??!0),l(t?.mode??`deterministic`),d(t?.routing?.mode??`session`),g(t?.routing?.provider??``),v(t?.routing?.model??``),b(t?.routing?.fallbackProfile??``),S(t?.routing?.fallbackModels??[]),w(t?.skills??[]),ee(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,JSON.stringify(e.supervisor)]);let O=()=>{let t={mode:u,...u===`fixed`&&p?{provider:p}:{},...u===`fixed`&&_?{model:_}:{},...u===`fallback_profile`&&y?{fallbackProfile:y}:{},...x.length?{fallbackModels:x}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:o,mode:c,intervalMs:Math.max(2,T)*1e3,recoveryMode:`auto`,...c===`agentic`?{routing:t,skills:C}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},k=o?t?.status??`starting`:`disabled`;return(0,K.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-1.5 text-left text-[11px] hover:bg-muted/40`,children:[(0,K.jsx)(E,{size:13,className:k===`healthy`?`text-success`:`text-warning`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:r(`activity:kanban.kanbanAgent`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[c,` · `,k]}),t?.summary&&(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,K.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?r(`activity:kanban.checkedAgo`,{ago:Je(t.lastAuditAt)}):r(`activity:kanban.notChecked`)}),(0,K.jsx)(h,{size:13,className:I(`transition-transform`,i&&`rotate-180`)})]}),i&&(0,K.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),(0,K.jsx)(`span`,{children:r(`activity:kanban.watchThisBoard`)})]}),(0,K.jsx)(Ze,{label:r(`activity:kanban.supervisorEngine`),value:c,options:[`deterministic`,`agentic`],onChange:e=>l(e)}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.auditInterval`)}),(0,K.jsx)(`input`,{type:`number`,min:2,value:T,onChange:e=>ee(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,K.jsx)(pe,{size:13}),` `,r(`activity:boardChrome.save`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.supervisor.audit`,{boardId:e.id}),className:`inline-flex h-8 items-center gap-1 rounded-md border px-3 hover:bg-muted`,children:[(0,K.jsx)(f,{size:13}),` `,r(`activity:boardChrome.auditNow`)]})]}),c===`deterministic`?(0,K.jsx)(`div`,{className:`lg:col-span-4 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-muted-foreground`,children:r(`activity:boardChrome.deterministicModeUsesNoProviderModel`)}):(0,K.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,K.jsx)(Ze,{label:r(`activity:kanban.kanbanAgentModelSource`),value:u,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>d(e)}),u===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:boardChrome.fixedProviderModel`)}),(0,K.jsx)(Ce,{value:_||void 0,provider:p||void 0,candidates:D,placeholder:r(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{v(e),g(t)}})]}),u===`fallback_profile`&&(0,K.jsx)(Ze,{label:r(`activity:kanban.fallbackProfile`),value:y,options:Object.keys(te.fallbackProfiles),placeholder:r(`activity:kanban.selectProfile`),onChange:b}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.supervisorSkills`)}),(0,K.jsx)(Ke,{options:te.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:C,onChange:w,placeholder:r(`activity:kanban.forceLoadSkills`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.extraFallbackModels`)}),(0,K.jsx)(Ke,{options:D.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:x,onChange:S,placeholder:r(`activity:kanban.optionalFallbacks`)})]})]})]})]})}function Ze({label:e,value:t,options:n,onChange:r,placeholder:i}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsxs)(`select`,{value:t,onChange:e=>r(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`,children:[i&&(0,K.jsx)(`option`,{value:``,children:i}),n.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]})}function Qe(e){let t=new Set;for(let n of e)n.status===`running`&&(t.add(n.id),t.add(n.name));return t}function $e(e){let t=new Set;e.sessionId&&t.add(e.sessionId);for(let n of e.registrySessionIds)t.add(n);for(let n of e.agents)n.status===`running`&&n.sessionId&&t.add(n.sessionId);return[...t]}function et(e,t){return e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&t.includes(e.slice(8)))===!0}function tt(e){return e?e.tasks.filter(e=>e.status===`in_progress`||e.assignment?.status===`running`||e.assignment?.status===`queued`).reduce((e,t)=>e+(t.costCeilingUsd??0),0):0}function nt(e){let t=e?.tags??[],n=t.includes(`sdd`)?`sdd`:t.includes(`goal`)?`goal`:null;if(!n)return null;let r=t.find(e=>e.startsWith(`run:`))?.slice(4);return{engine:n,...r?{runId:r}:{}}}function rt({boardTotal:e,activeBoardTotal:t,orphanedBoardTotal:n,activeBoardId:r,activeBoards:a,orphanedBoards:o,boardPage:s,boardPageSize:c,loading:l,newBoardTitle:u,onClose:d,onRefresh:f,onNewBoardTitleChange:p,onCreateBoard:h,onBoardSelect:g,onBoardPageChange:_}){let{t:v}=m();return(0,K.jsxs)(`aside`,{className:`flex max-h-[45dvh] w-full shrink-0 flex-col border-b bg-card/40 md:max-h-none md:w-[280px] md:border-b-0 md:border-r`,children:[(0,K.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,K.jsx)(`button`,{type:`button`,title:v(`common:action.back`),onClick:d,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(P,{size:16})}),(0,K.jsx)(y,{size:17,className:`text-primary`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:v(`activity:kanban.kanban`)}),(0,K.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[e,` boards · `,t,` active · `,n,` orphaned`]})]}),(0,K.jsx)(`button`,{type:`button`,title:v(`common:action.refresh`),onClick:f,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(he,{size:15,className:l?`animate-spin`:void 0})})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:v(`activity:kanban.newBoard`),className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,title:v(`activity:kanban.createBoard`),onClick:h,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(i,{size:16})})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[a.length>0&&(0,K.jsxs)(`div`,{className:`mb-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-success`,children:[`Active session · `,t]}),a.map(e=>(0,K.jsx)(it,{board:e,active:r===e.id,dotClassName:`bg-success`,onSelect:g},e.id)),o.length>0&&(0,K.jsxs)(`div`,{className:`mb-1 mt-2 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`No active session · `,n]}),o.map(e=>(0,K.jsx)(it,{board:e,active:r===e.id,dotClassName:`bg-muted-foreground/45`,onSelect:g},e.id))]}),(0,K.jsx)(we,{page:s,pageSize:c,totalItems:e,onPageChange:_,compact:!0,itemLabel:`boards`})]})}function it({board:e,active:t,dotClassName:n,onSelect:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:I(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,t?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:I(`h-1.5 w-1.5 rounded-full`,n)}),e.taskCount,` tasks`]}),(0,K.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]})}var at={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function ot({title:e,value:t,inherited:n,onSave:r}){let{t:i}=m(),[a,o]=(0,z.useState)(t??at),[s,c]=(0,z.useState)(ct(t?.allow??[])),[l,u]=(0,z.useState)(ct(t?.deny??[])),[d,f]=(0,z.useState)(null);return(0,z.useEffect)(()=>{o(t??at),c(ct(t?.allow??[])),u(ct(t?.deny??[])),f(null)},[t]),(0,K.jsxs)(`details`,{className:`rounded-md border border-primary/25 bg-primary/5`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-xs font-semibold`,children:[(0,K.jsx)(E,{size:14,className:`text-primary`}),(0,K.jsx)(`span`,{children:e}),(0,K.jsx)(`span`,{className:`ml-auto font-normal text-muted-foreground`,children:t?.enabled?`${t.enforcement} · ${t.allow.length} allow · shell ${t.shellAccess}`:n?.enabled?`inherits board boundary`:`unrestricted`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[n?.enabled&&(0,K.jsx)(`div`,{className:`rounded border border-warning/25 bg-warning/10 px-2 py-1.5 text-muted-foreground`,children:i(`activity:kanbanBoundaryEditor.boardPolicyRemainsAuthoritativeThisTask`)}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),i(`activity:kanban.enableLayer`)]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`label`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:i(`activity:kanban.outsideScope`)}),(0,K.jsxs)(`select`,{value:a.enforcement,onChange:e=>o({...a,enforcement:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:i(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:i(`activity:kanban.alwaysBlock`)})]})]}),(0,K.jsxs)(`label`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:i(`activity:kanbanBoundaryEditor.shellOpaqueTools`)}),(0,K.jsxs)(`select`,{value:a.shellAccess,onChange:e=>o({...a,shellAccess:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:i(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:i(`activity:kanban.alwaysBlock`)}),(0,K.jsx)(`option`,{value:`allow`,children:i(`activity:kanban.allow`)})]})]})]}),(0,K.jsx)(st,{label:i(`activity:kanban.allowSelectors`),value:s,onChange:c}),(0,K.jsx)(st,{label:i(`activity:kanban.denySelectors`),value:l,onChange:u}),(0,K.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`One per line: kind:access:path — for example directory:read_write:packages/webui or file:read:README.md. Kinds: file, directory, package, glob. If an access type has no allow selector, it remains unrestricted except for deny rules. `,i(`activity:kanban.crossPathSelectors`)]}),d&&(0,K.jsx)(`div`,{className:`text-destructive`,children:d}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=lt(s),t=lt(l);r({...a,allow:e,deny:t}),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},className:`inline-flex h-8 flex-1 items-center justify-center gap-2 rounded bg-primary text-primary-foreground`,children:[(0,K.jsx)(pe,{size:13}),` `,i(`activity:kanbanBoundaryEditor.saveBoundary`)]}),t&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:i(`activity:kanban.removeLayer`)})]})]})]})}function st({label:e,value:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,K.jsx)(`textarea`,{rows:3,value:t,onChange:e=>n(e.target.value),className:`w-full resize-y rounded border bg-background px-2 py-1.5 font-mono text-[11px] outline-none focus:border-primary`})]})}function ct(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
2
- `)}function lt(e){let t=new Set([`file`,`directory`,`package`,`glob`]),n=new Set([`read`,`write`,`read_write`]);return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,r)=>{let i=e.indexOf(`:`),a=e.indexOf(`:`,i+1);if(i<=0||a<=i+1||a===e.length-1)throw Error(`Boundary line ${r+1} must use kind:access:path.`);let o=e.slice(0,i),s=e.slice(i+1,a),c=e.slice(a+1).trim();if(!c)throw Error(`Boundary line ${r+1} must use kind:access:path.`);if(!t.has(o))throw Error(`Boundary line ${r+1} has unknown kind.`);if(!n.has(s))throw Error(`Boundary line ${r+1} has unknown access.`);return{kind:o,access:s,path:c}})}function ut({audit:e,onSelectTask:t}){let[n,r]=(0,z.useState)(!0),i=(0,z.useId)();if((0,z.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let a=dt(e.issues);return(0,K.jsxs)(`section`,{"aria-labelledby":`${i}-title`,className:`shrink-0 border-b border-warning/25 bg-card/95 shadow-[inset_0_1px_0_hsl(var(--warning)/0.08)]`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-warning/25 bg-warning/10 text-warning`,children:(0,K.jsx)(S,{size:14,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{id:`${i}-title`,className:`text-xs font-semibold text-foreground`,children:[`Kanban Cleaner found `,e.issues.length,` `,e.issues.length===1?`issue`:`issues`]}),(0,K.jsxs)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.affectedTaskCount,` `,e.affectedTaskCount===1?`card needs`:`cards need`,` attention`]})]})]}),e.counts.error>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-destructive/25 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive`,children:[(0,K.jsx)(c,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning`,children:[(0,K.jsx)(p,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,K.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,"aria-label":n?`Collapse Kanban Cleaner issues`:`Expand Kanban Cleaner issues`,onClick:()=>r(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:(0,K.jsx)(h,{size:14,"aria-hidden":`true`,className:I(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,K.jsx)(`ul`,{id:i,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:a.map(({taskId:e,taskTitle:n,issues:r})=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Open ${n}: ${r.map(e=>e.message).join(`, `)}`,className:`group flex w-full items-start gap-2 rounded-md border border-border/70 bg-background/70 px-2.5 py-2 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,K.jsx)(`span`,{className:I(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,r.some(e=>e.severity===`error`)?`bg-destructive shadow-[0_0_8px_hsl(var(--destructive)/0.55)]`:`bg-warning shadow-[0_0_8px_hsl(var(--warning)/0.45)]`),"aria-hidden":`true`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,K.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-[10px] leading-4 text-muted-foreground`,children:r.map(e=>e.message).join(` · `)})]})]})},e))})]})}function dt(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}function ft({board:e,sendKanban:n,onSelectTask:r}){let{t:i}=m(),[a,o]=(0,z.useState)(!1),s=e.tasks.filter(e=>e.decomposition?.status===`proposed`);return s.length?(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-warning/30 bg-warning/5 px-4 py-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`flex w-full items-center gap-2 text-left text-xs font-semibold text-warning`,children:[a?(0,K.jsx)(C,{size:13}):(0,K.jsx)(h,{size:13}),(0,K.jsx)(O,{size:13}),s.length,` decomposition proposal`,s.length>1?`s`:``,` awaiting approval`]}),!a&&(0,K.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:s.map(a=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(a.id),className:`min-w-0 flex-1 truncate text-left hover:underline`,children:[a.title,(0,K.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`→ `,a.decomposition?.proposedSubtasks.length??0,` subtasks`]})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.approve`,{boardId:e.id,taskId:a.id,proposalId:a.decomposition.id}),className:`inline-flex items-center gap-1 rounded-md bg-success/10 px-2 py-1 text-[11px] font-medium text-success hover:bg-success/20`,children:[(0,K.jsx)(t,{size:12}),` `,i(`activity:kanbanDecomp.approve`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.reject`,{boardId:e.id,taskId:a.id,proposalId:a.decomposition.id}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive hover:bg-destructive/20`,children:[(0,K.jsx)(k,{size:12}),` `,i(`activity:kanbanDecomp.reject`)]})]},a.id))})]}):null}var pt=[`assessed`,`proposed`,`approval`,`applied`];function mt(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function ht({board:e,task:n,sendKanban:r,onSelectTask:i}){let{t:a}=m(),o=n.decomposition,s=mt(n),c=(0,z.useMemo)(()=>{if(!o)return null;let t=(o.appliedChildTaskIds??[]).map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return{tasks:[{id:n.id,shortId:`parent`,title:n.title,displayStatus:o.status===`applied`?`completed`:`in_progress`,priority:n.priority,deps:[]},...o.proposedSubtasks.map((e,r)=>{let i=t[r];return{id:i?.id??`proposed-${r}`,shortId:`s${r}`,title:e.title,displayStatus:i?i.status===`completed`?`completed`:i.status===`failed`?`failed`:i.status===`in_progress`?`in_progress`:`pending`:o.status===`approved`?`queued`:`pending`,priority:n.priority,deps:(e.dependsOnIndex??[]).map(e=>`s${e}`)}})],columns:[{label:a(`activity:kanbanDecomp.parent`),taskIds:[`parent`]},{label:o.status===`applied`?`Subtasks`:`Proposed subtasks`,taskIds:o.proposedSubtasks.map((e,t)=>`s${t}`)}],appliedChildren:t}},[e,o,n]);return!o&&!n.atomicityAssessment?null:(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,K.jsx)(O,{size:13}),a(`activity:kanbanDecomp.decomposition`)]}),(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 text-[11px]`,children:[pt.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`→`}),(0,K.jsx)(`span`,{className:I(`rounded px-1.5 py-0.5`,o?.status===`rejected`&&t===2?`bg-destructive/10 text-destructive`:t<=s?`bg-primary/10 font-medium text-primary`:`bg-muted text-muted-foreground`),children:o?.status===`rejected`&&t===2?`rejected`:e})]},e)),n.atomicityAssessment&&(0,K.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[n.atomicityAssessment.verdict,` · score `,n.atomicityAssessment.score]})]}),!o&&n.atomicityAssessment?.verdict===`needs_decomposition`&&(0,K.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2 text-[11px] text-warning`,children:[a(`activity:kanbanDecomp.thisTaskShouldBeSplitBefore`),(0,K.jsx)(`ul`,{className:`ml-4 mt-1 list-disc`,children:n.atomicityAssessment.criteria.filter(e=>e.score<1).map(e=>(0,K.jsx)(`li`,{children:e.reason},e.id))})]}),o&&c&&(0,K.jsxs)(K.Fragment,{children:[o.rationale&&(0,K.jsxs)(`div`,{className:`mb-2 text-[11px] text-muted-foreground`,children:[`“`,o.rationale,`”`]}),(0,K.jsx)(`div`,{className:`h-64 overflow-hidden rounded-md border`,children:(0,K.jsx)(Te,{tasks:c.tasks,columns:c.columns,onTaskClick:t=>{e.tasks.some(e=>e.id===t)&&i(t)}})}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-1 text-[11px]`,children:o.proposedSubtasks.map((e,t)=>(0,K.jsxs)(`li`,{className:`rounded bg-muted/40 px-2 py-1`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.title}),e.successCriteria?.length?(0,K.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`✓ `,e.successCriteria.join(` · `)]}):null]},`${e.title}-${t}`))}),o.status===`proposed`&&(0,K.jsxs)(`div`,{className:`mt-2 flex gap-1.5`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`kanban.decomposition.approve`,{boardId:e.id,taskId:n.id,proposalId:o.id}),className:`inline-flex items-center gap-1 rounded-md bg-success/10 px-2.5 py-1.5 text-xs font-medium text-success hover:bg-success/20`,children:[(0,K.jsx)(t,{size:13}),` `,a(`activity:kanbanDecomp.approveAmpSplit`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`kanban.decomposition.reject`,{boardId:e.id,taskId:n.id,proposalId:o.id}),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/20`,children:[(0,K.jsx)(k,{size:13}),` `,a(`activity:kanbanDecomp.reject`)]})]}),o.status===`applied`&&c.appliedChildren.length>0&&(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:c.appliedChildren.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:`rounded-md border px-2 py-1 text-[11px] hover:bg-muted`,children:[e.title,(0,K.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`[`,e.status,`]`]})]},e.id))}),o.status===`rejected`&&o.resolutionReason&&(0,K.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Rejected: `,o.resolutionReason]})]})]})}var gt=[`id`,`name`,`type`];function q(e){if(typeof e==`string`)return e.trim()||void 0;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;for(let e of gt){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function _t(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var vt=new Set([`completed`,`review`,`failed`]);function yt(e){let t={totalTasks:e.tasks.length,gradedTasks:0,passed:0,failed:0,needsHuman:0,incomplete:0,unverified:0,failingChecks:[],missingEvidence:[],needsDecomposition:[],pendingProposals:[]};for(let n of e.tasks){if(n.status===`archived`)continue;let e=n.verificationReport;if(vt.has(n.status)&&(t.gradedTasks+=1,e?e.verdict===`passed`?t.passed+=1:e.verdict===`failed`?t.failed+=1:e.verdict===`needs_human`?t.needsHuman+=1:t.incomplete+=1:t.unverified+=1),e)for(let r of e.checks)(r.status===`failed`||r.status===`error`)&&t.failingChecks.push({task:n,check:r}),(r.type===`agent`||r.type===`council`)&&r.status===`passed`&&!r.backingRefs?.length&&t.missingEvidence.push({task:n,check:r});!n.childTaskIds?.length&&n.atomicityAssessment?.verdict===`needs_decomposition`&&n.status!==`completed`&&t.needsDecomposition.push(n),n.decomposition?.status===`proposed`&&t.pendingProposals.push(n)}return t}function bt(e){let t=new Map(e.tasks.map(e=>[e.id,e])),n=new Set,r=(e,i)=>{n.add(e.id);let a=e.childTaskIds??[],o=[];for(let e of a){let a=t.get(e);!a||n.has(a.id)||o.push(r(a,i+1))}return{task:e,children:o,depth:i}},i=[];for(let a of e.tasks)a.parentTaskId&&t.get(a.parentTaskId)||n.has(a.id)||i.push(r(a,0));return i}function xt(e){let t=[],n=e=>{t.push(e);for(let t of e.children)n(t)};for(let t of e)n(t);return t}function St(e,t){return e?.columns.find(e=>e.id===t)?.title??t}function Ct({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function J({label:e,value:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`})]})}function wt({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsxs)(`select`,{value:t,onChange:e=>i(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:[r&&(0,K.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]})}function Tt(e){let t=`rounded px-1.5 py-0.5`;return e===`critical`?`${t} bg-destructive/10 text-destructive`:e===`high`?`${t} bg-warning/10 text-warning`:e===`low`?`${t} bg-muted text-muted-foreground`:`${t} bg-info/10 text-info`}function Et(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Dt(e){return e===`completed`||e===`failed`||e===`cancelled`}function Ot(e,t){return t?Math.round(e/t*100):0}function kt(e,t,n,r=new Date){let i=[],a=n.filter(e=>e.taskId===t.id),o=a.filter(e=>e.type!==`task.created`),s=o.filter(e=>e.type!==`task.assignment.heartbeat`&&e.type!==`task.assignment.snapshot`),c=s.filter(e=>!!e.note?.trim()),l=t.assignment,u=r.getTime(),d=100,f=(e,t=0)=>{i.some(t=>t.id===e.id)||(i.push(e),d=Math.max(0,d-t))};t.dueDate&&![`completed`,`archived`].includes(t.status)&&Date.parse(t.dueDate)<u&&f({id:`overdue`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.overdueTitle`,detailKey:`activity:taskRisk.overdueDetail`,detailParams:{dueDate:String(t.dueDate),status:String(t.status)},remediationKey:`activity:taskRisk.overdueFix`});let p=(t.dependsOn??[]).filter(t=>!e.tasks.some(e=>e.id===t));p.length&&f({id:`missing-dependency`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.missingDependencyTitle`,detailKey:`activity:taskRisk.missingDependencyDetail`,detailParams:{count:p.length},remediationKey:`activity:taskRisk.missingDependencyFix`});let m=(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return n&&![`completed`,`archived`].includes(n.status)});m.length&&f({id:`unresolved-dependency`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.unresolvedDependencyTitle`,detailKey:`activity:taskRisk.unresolvedDependencyDetail`,detailParams:{count:m.length},remediationKey:`activity:taskRisk.unresolvedDependencyFix`}),(l?.status===`failed`||l?.error)&&f({id:`assignment-failed`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.assignmentFailedTitle`,...l.error??l.lastFailureKind?{detailKey:`activity:taskRisk.assignmentFailedDetail`,detailParams:{reason:String(l.error??l.lastFailureKind)}}:{detailKey:`activity:taskRisk.assignmentFailedDetailGeneric`},remediationKey:`activity:taskRisk.assignmentFailedFix`}),l?.status===`failed`&&l.maxAttempts!==void 0&&(l.attempt??0)>=l.maxAttempts&&f({id:`retry-exhausted`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.retryExhaustedTitle`,detailKey:`activity:taskRisk.retryExhaustedDetail`,detailParams:{used:l.attempt??0,max:String(l.maxAttempts)},remediationKey:`activity:taskRisk.retryExhaustedFix`}),l&&[`queued`,`running`].includes(l.status)&&l.leaseExpiresAt&&Date.parse(l.leaseExpiresAt)<=u&&f({id:`lease-expired`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.leaseExpiredTitle`,detailKey:`activity:taskRisk.leaseExpiredDetail`,detailParams:{expiresAt:String(l.leaseExpiresAt),status:String(l.status)},remediationKey:`activity:taskRisk.leaseExpiredFix`}),l?.status===`running`&&l.heartbeatAt&&u-Date.parse(l.heartbeatAt)>5*6e4&&f({id:`heartbeat-stale`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.staleHeartbeatTitle`,detailKey:`activity:taskRisk.staleHeartbeatDetail`,detailParams:{since:String(l.heartbeatAt)},remediationKey:`activity:taskRisk.staleHeartbeatFix`}),t.status===`in_progress`&&!l&&f({id:`unowned-in-progress`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.noAssignmentTitle`,detailKey:`activity:taskRisk.noAssignmentDetail`,remediationKey:`activity:taskRisk.noAssignmentFix`});let h=(t.successCriteria??[]).filter(e=>e.status===`failed`),g=(t.successCriteria??[]).filter(e=>e.status===`pending`);h.length&&f({id:`failed-checks`,severity:t.status===`completed`?`critical`:`warning`,category:`operational`,titleKey:`activity:taskRisk.failedChecksTitle`,detailKey:`activity:taskRisk.failedChecksDetail`,detailParams:{count:h.length},remediationKey:`activity:taskRisk.failedChecksFix`}),t.status===`completed`&&g.length&&f({id:`completed-with-pending-checks`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.pendingChecksTitle`,detailKey:`activity:taskRisk.pendingChecksDetail`,detailParams:{count:g.length},remediationKey:`activity:taskRisk.pendingChecksFix`}),a.length?a.some(e=>e.type===`task.created`)||f({id:`missing-creation-event`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.noProvenanceTitle`,detailKey:`activity:taskRisk.noProvenanceDetail`,remediationKey:`activity:taskRisk.noProvenanceFix`},10):f({id:`no-durable-events`,severity:`critical`,category:`audit`,titleKey:`activity:taskRisk.noEventsTitle`,detailKey:`activity:taskRisk.noEventsDetail`,remediationKey:`activity:taskRisk.noEventsFix`},25);let _=Ot(o.filter(e=>!!e.actor).length,o.length),v=Ot(o.filter(e=>!!e.sessionId).length,o.length),y=Ot(c.length,s.length);o.length&&_<100&&f({id:`actor-coverage`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.actorCoverageTitle`,detailKey:`activity:taskRisk.actorCoverageDetail`,detailParams:{percent:_},remediationKey:`activity:taskRisk.actorCoverageFix`},10),o.length&&v<100&&f({id:`session-coverage`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.sessionCoverageTitle`,detailKey:`activity:taskRisk.sessionCoverageDetail`,detailParams:{percent:v},remediationKey:`activity:taskRisk.sessionCoverageFix`},10),s.length&&y<50&&f({id:`reason-coverage`,severity:`info`,category:`audit`,titleKey:`activity:taskRisk.reasonCoverageTitle`,detailKey:`activity:taskRisk.reasonCoverageDetail`,detailParams:{percent:y},remediationKey:`activity:taskRisk.reasonCoverageFix`},10);let b={...Et([...a].sort((e,t)=>t.ts.localeCompare(e.ts)).find(e=>e.type===`task.assigned`||e.type.startsWith(`task.assignment.`))?.after),...l??{}},x=!!(b.provider||b.model||b.modelRouting);l&&!x&&f({id:`missing-route`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.noRouteTitle`,detailKey:`activity:taskRisk.noRouteDetail`,remediationKey:`activity:taskRisk.noRouteFix`},10);let S=!!(l?.lastResult||l?.error||a.some(e=>Dt(String(Et(e.after).status??``))&&!!e.note?.trim()));return Dt(l?.status)&&!S&&f({id:`missing-terminal-evidence`,severity:`critical`,category:`audit`,titleKey:`activity:taskRisk.missingTerminalEvidenceTitle`,detailKey:`activity:taskRisk.missingTerminalEvidenceDetail`,detailParams:{status:String(l?.status)},remediationKey:`activity:taskRisk.missingTerminalEvidenceFix`},15),i.sort((e,t)=>{let n={critical:0,warning:1,info:2};return n[e.severity]-n[t.severity]}),{score:d,findings:i,critical:i.filter(e=>e.severity===`critical`).length,warnings:i.filter(e=>e.severity===`warning`).length,coverage:{durableEvents:a.length,actorPercent:_,sessionPercent:v,reasonPercent:y,hasExecutionRoute:x,hasTerminalEvidence:S}}}function At(e){return e===`critical`?`border-destructive/30 bg-destructive/5 text-destructive`:e===`warning`?`border-warning/30 bg-warning/5 text-warning`:`border-info/30 bg-info/5 text-info`}function jt({board:e,task:t,events:n}){let{t:r}=m(),i=kt(e,t,n),a=L(i.findings,8,t.id);return(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(g,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:r(`activity:taskRisk.riskAuditQuality`)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${i.score>=90?`bg-success/10 text-success`:i.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:r(`activity:taskRisk.auditScore`,{score:i.score})}),i.critical>0&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:r(`activity:taskRisk.criticalCount`,{count:i.critical})}),(0,K.jsx)(h,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,K.jsx)(`div`,{className:`grid grid-cols-3 gap-1 text-center sm:grid-cols-6`,children:[[r(`activity:taskRisk.covEvents`),i.coverage.durableEvents],[r(`activity:taskRisk.covActor`),`${i.coverage.actorPercent}%`],[r(`activity:taskRisk.covSession`),`${i.coverage.sessionPercent}%`],[r(`activity:taskRisk.covReasons`),`${i.coverage.reasonPercent}%`],[r(`activity:taskRisk.covRoute`),i.coverage.hasExecutionRoute?r(`common:action.yes`):r(`common:action.no`)],[r(`activity:taskRisk.covOutcome`),i.coverage.hasTerminalEvidence?r(`common:action.yes`):r(`common:action.no`)]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,K.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),i.findings.length===0?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-success/30 bg-success/5 px-2.5 py-2 text-[11px] text-success`,children:[(0,K.jsx)(x,{className:`size-4`}),` `,r(`activity:taskRisk.noDeterministicTaskRisksDetected`)]}):(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[a.pageItems.map(e=>(0,K.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${At(e.severity)}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,K.jsx)(me,{className:`size-3.5`}):(0,K.jsx)(p,{className:`size-3.5`}),r(e.titleKey),(0,K.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[r(`activity:taskRisk.cat.${e.category}`),` ·`,` `,r(`activity:taskRisk.sev.${e.severity}`)]})]}),(0,K.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:r(e.detailKey,e.detailParams??{})}),(0,K.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskRisk.next`)}),` `,r(e.remediationKey)]})]},e.id)),(0,K.jsx)(we,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,compact:!0,itemLabel:r(`activity:taskRisk.itemLabel`)})]})]})]})}function Mt(e,t,n){let r=t.assignment,i=kt(e,t,[]).findings.filter(e=>e.category===`operational`),a=q(r?.provider),o=q(r?.model);return{owner:q(r?.name)??q(r?.agentId)??q(r?.role)??q(t.assignee)??q(t.assignedAgent)??`Unassigned`,route:a||o?`${a?`${a}/`:``}${o??`default`}`:r?.modelRouting===`session`?`session default`:`default route`,blockers:(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return!n||![`completed`,`archived`].includes(n.status)}).length,attempts:r?.attempt?`${r.attempt}${r.maxAttempts?`/${r.maxAttempts}`:``}`:`0`,fallbackCount:+!!r?.fallbackProfile+(r?.fallbackModels?.length??0),activeUsers:(e.presence??[]).filter(e=>e.taskId===t.id&&e.active).length,failed:t.status===`failed`||r?.status===`failed`||!!r?.error,criticalRisks:i.filter(e=>e.severity===`critical`).length,warningRisks:i.filter(e=>e.severity===`warning`).length,verification:_t(t,n?.[`${e.id}:${t.id}`]),subtaskCounts:(()=>{let n=t.childTaskIds??[];if(!n.length)return null;let r=n.map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return r.length?{done:r.filter(e=>[`completed`,`review`,`archived`].includes(e.status)).length,total:r.length}:null})(),atomicityVerdict:t.atomicityAssessment?.verdict??null,evidenceCount:t.verificationReport?.attachments.length??0,pendingDecomposition:t.decomposition?.status===`proposed`}}function Nt({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let{t:c}=m(),l=ye(e=>e.verificationActivity),u=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,K.jsxs)(`section`,{className:I(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,u.length===0?`w-[180px]`:`w-[310px]`),children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,K.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:u.length})]}),(0,K.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragOver:e=>e.preventDefault(),onDrop:n=>{n.preventDefault(),e.lifecycle?.mode!==`managed`&&r&&s(r,t.id),i(null)},children:u.map(t=>{let r=Mt(e,t,l);return(0,K.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&i(t.id)},onDragEnd:()=>i(null),className:I(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,n===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>a(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(t.atomic||r.atomicityVerdict)&&(0,K.jsx)(`span`,{className:I(`shrink-0 rounded px-1 py-0.5 text-[10px] font-medium`,r.atomicityVerdict===`needs_decomposition`?`bg-destructive/15 text-destructive`:r.atomicityVerdict===`composite`?`bg-info/15 text-info`:r.atomicityVerdict===`borderline`||t.atomic?`bg-warning/15 text-warning`:`bg-muted text-muted-foreground`),title:r.atomicityVerdict?`Atomicity: ${r.atomicityVerdict}`:`Atomic task (subtree verification required)`,children:t.atomic?`atomic`:r.atomicityVerdict===`needs_decomposition`?`split me`:r.atomicityVerdict}),(0,K.jsx)(`span`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title})]}),t.description&&(0,K.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,K.jsx)(`button`,{type:`button`,title:c(`activity:kanban.deleteTask`),"aria-label":c(`activity:kanban.deleteTaskAria`,{title:t.title}),onClick:()=>o(t),className:`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,K.jsx)(ae,{size:14})})]}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:Tt(t.priority),children:t.priority}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),r.owner!==`Unassigned`&&(0,K.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:r.owner}),t.assignment&&(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:r.route}),t.assignment?.attempt?(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,r.attempts]}):null,r.fallbackCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.fallbackCount,` fallback`]}),r.blockers>0?(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.blockers,` blocker`]}):null,r.activeUsers>0&&(0,K.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[r.activeUsers,` active`]}),r.failed&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:c(`activity:kanban.runFailed`)}),r.criticalRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[r.criticalRisks,` critical risk`]}),r.warningRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.warningRisks,` warning`]}),t.chain&&(0,K.jsxs)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:[`chain `,t.chain.order+1]}),t.assignment?.skills?.length?(0,K.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[t.assignment.skills.length,` skills`]}):null,r.verification!==`unverified`&&(0,K.jsxs)(`span`,{className:I(`rounded px-1.5 py-0.5`,r.verification===`passed`?`bg-success/10 text-success`:r.verification===`failed`?`bg-destructive/10 text-destructive`:`bg-warning/10 text-warning`),children:[`✓ `,r.verification]}),r.subtaskCounts&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.subtaskCounts.done,`/`,r.subtaskCounts.total,` subtasks`]}),r.evidenceCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:[r.evidenceCount,` evidence`]}),r.pendingDecomposition&&(0,K.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:c(`activity:kanban.splitPendingApproval`)})]})]},t.id)})})]})}function Pt({queueHealth:e,runningCostTotal:t}){let{t:n}=m();return(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:n(`activity:kanban.queueHealth`)}),e.counts.ready>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.claimableTasks`),className:`inline-flex items-center gap-1 text-success`,children:[e.counts.ready,` `,n(`activity:kanban.statusReady`)]}),e.counts.running>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.runningAssignments`),className:`inline-flex items-center gap-1 text-warning`,children:[e.counts.running,` `,n(`activity:kanban.statusRunning`)]}),e.counts.review>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.inReview`),className:`inline-flex items-center gap-1 text-primary`,children:[e.counts.review,` `,n(`activity:kanban.statusReview`)]}),e.counts.blocked>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.manuallyBlocked`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.blocked,` `,n(`activity:kanban.statusBlocked`)]}),e.counts.failed>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.failedTasks`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.failed,` `,n(`activity:kanban.statusFailed`)]}),e.dependencyBlocked.count>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.blockedByDeps`),className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[e.dependencyBlocked.count,` `,n(`activity:kanban.statusBlockedByDeps`)]}),e.staleAssignments.count>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.expiredLeases`),className:`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[e.staleAssignments.count,` `,n(`activity:kanban.statusStale`)]}),e.heartbeatDue.count===0&&e.staleAssignments.count===0&&e.dependencyBlocked.count===0&&(0,K.jsx)(`span`,{className:`text-success`,children:n(`activity:kanban.healthy`)}),t>0&&(0,K.jsx)(`span`,{title:n(`activity:kanban.costCeilingSum`),className:`inline-flex items-center gap-1 text-info`,children:n(`activity:kanban.runningCost`,{cost:t.toFixed(2)})})]})}function Ft({runLink:e,sendRaw:t}){let{t:n}=m(),i=e.engine===`sdd`,a=i?`sdd.board`:`goal`,o=xe(e=>e.setCurrentView),s=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase text-primary`,children:[(0,K.jsx)(ne,{size:11}),` `,e.engine]}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n(`activity:kanban.liveRunSteer`)}),i&&(0,K.jsxs)(`button`,{type:`button`,className:s,title:n(`activity:kanban.openLiveRun`),onClick:()=>o(`sddhub`),children:[(0,K.jsx)(ne,{size:12}),` `,n(`activity:kanban.openLiveRun`)]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`${a}.pause`),children:[(0,K.jsx)(oe,{size:12}),` `,n(`activity:kanban.actionPause`)]}),(0,K.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`${a}.resume`),children:[(0,K.jsx)(N,{size:12}),` `,n(`activity:kanban.actionResume`)]}),i&&(0,K.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`sdd.board.retry_all_failed`),children:[(0,K.jsx)(le,{size:12}),` `,n(`activity:kanban.actionRetryFailed`)]}),(0,K.jsxs)(`button`,{type:`button`,className:I(s,`text-destructive hover:bg-destructive/10`),onClick:()=>t(`${a}.stop`),children:[(0,K.jsx)(r,{size:12}),` `,n(`activity:kanban.actionStop`)]})]})]})}function It({boardId:e,sendKanban:t}){let{t:n}=m(),r=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium text-primary hover:bg-primary/10`;return(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,K.jsx)(ne,{size:13,className:`text-primary`}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n(`activity:kanban.runAsLiveJob`)}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,className:r,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:n(`activity:kanban.startAsGoal`)}),(0,K.jsx)(`button`,{type:`button`,className:r,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:n(`activity:kanban.startAsSdd`)})]})]})}function Lt({runLink:e,runTaskId:n,modelCandidates:i,sendRaw:a}){let{t:o}=m(),s=e.engine===`sdd`,[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),f=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,p=()=>{let e=u.trim();e&&(a(s?`sdd.board.reassign`:`goal.assignTask`,{taskId:n,agentName:e}),l(!1),d(``))};return(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:o(`activity:kanban.runControls`)}),s&&(0,K.jsxs)(`div`,{className:`mb-2`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:o(`activity:kanban.workerModel`)}),(0,K.jsx)(Ce,{candidates:i,placeholder:o(`activity:kanban.setModelForTask`),onPick:(e,t)=>a(`sdd.board.set_task_model`,{taskId:n,model:e,provider:t})})]}),c?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&l(!1)},placeholder:o(`activity:kanban.newWorkerName`),className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:p,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,K.jsx)(t,{size:14})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,K.jsx)(k,{size:14})})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:f,onClick:()=>a(s?`sdd.board.retry`:`goal.retryTask`,{taskId:n}),children:[(0,K.jsx)(le,{size:13}),` `,o(`common:action.retry`)]}),(0,K.jsxs)(`button`,{type:`button`,className:f,onClick:()=>l(!0),children:[(0,K.jsx)(v,{size:13}),` `,o(`activity:kanban.actionReassign`)]}),s?(0,K.jsxs)(`button`,{type:`button`,className:I(f,`text-destructive hover:bg-destructive/10`),onClick:()=>a(`sdd.board.cancel_task`,{taskId:n}),children:[(0,K.jsx)(r,{size:13}),` `,o(`common:action.cancel`)]}):(0,K.jsxs)(`button`,{type:`button`,className:f,onClick:()=>a(`goal.runTask`,{taskId:n}),children:[(0,K.jsx)(N,{size:13}),` `,o(`activity:kanban.actionRunNow`)]})]})]})}var Rt={unverified:{labelKey:`activity:kanbanTree.verifyUnverified`,className:`bg-muted text-muted-foreground`,icon:T},running:{labelKey:`activity:kanbanTree.verifyVerifying`,className:`bg-info/10 text-info`,icon:M},passed:{labelKey:`activity:kanbanTree.verifyVerified`,className:`bg-success/10 text-success`,icon:E},failed:{labelKey:`activity:kanbanTree.verifyFailed`,className:`bg-destructive/10 text-destructive`,icon:fe},needs_human:{labelKey:`activity:kanbanTree.verifyNeedsReview`,className:`bg-warning/10 text-warning`,icon:p},incomplete:{labelKey:`activity:kanbanTree.verifyIncomplete`,className:`bg-warning/10 text-warning`,icon:p}};function zt({task:e}){return e.status===`completed`?(0,K.jsx)(t,{size:13,className:`text-success`}):e.status===`failed`?(0,K.jsx)(k,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,K.jsx)(M,{size:13,className:`animate-spin text-info`}):(0,K.jsx)(b,{size:13,className:`text-muted-foreground`})}function Bt({board:e,selectedTaskId:t,onSelectTask:n}){let{t:r}=m(),i=ye(e=>e.verificationActivity),a=(0,z.useMemo)(()=>xt(bt(e)),[e]);return a.length?(0,K.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:a.map(({task:a,depth:o,children:s})=>{let c=_t(a,i[`${e.id}:${a.id}`]),l=Rt[c],u=l.icon,d=a.atomicityAssessment?.verdict;return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(a.id),style:{paddingLeft:`${o*22+8}px`},className:I(`flex w-full items-center gap-2 rounded-md border py-1.5 pr-2 text-left text-xs transition-colors`,t===a.id?`border-primary bg-primary/5`:`border-transparent hover:border-primary/40 hover:bg-muted/40`),children:[s.length>0?(0,K.jsx)(C,{size:12,className:`shrink-0 text-muted-foreground`}):(0,K.jsx)(`span`,{className:`w-3 shrink-0`}),(0,K.jsx)(zt,{task:a}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:a.title}),a.atomic&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-warning/15 px-1 py-0.5 text-[10px] text-warning`,children:`atomic`}),d&&d!==`atomic`&&(0,K.jsx)(`span`,{className:I(`shrink-0 rounded px-1 py-0.5 text-[10px]`,d===`needs_decomposition`?`bg-destructive/15 text-destructive`:d===`composite`?`bg-info/15 text-info`:`bg-warning/15 text-warning`),children:d===`needs_decomposition`?`split me`:d}),a.decomposition?.status===`proposed`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-warning/10 px-1 py-0.5 text-[10px] text-warning`,children:r(`activity:kanbanTree.proposalPending`)}),(0,K.jsxs)(`span`,{className:I(`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px]`,l.className),children:[(0,K.jsx)(u,{size:11,className:c===`running`?`animate-spin`:void 0}),r(l.labelKey)]})]})},a.id)})})}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:r(`activity:kanbanTree.noTasksOnThisBoardYet`)})}function Vt({label:e,value:t,tone:n}){return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,K.jsx)(`div`,{className:I(`text-xl font-bold`,n===`success`&&`text-success`,n===`destructive`&&`text-destructive`,n===`warning`&&`text-warning`,n===`muted`&&`text-muted-foreground`),children:t}),(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e})]})}function Ht({title:e,icon:t,tone:n,rows:r,onSelectTask:i}){return r.length?(0,K.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,K.jsxs)(`div`,{className:I(`flex items-center gap-2 border-b px-3 py-2 text-xs font-semibold`,n),children:[(0,K.jsx)(t,{size:14}),e,(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:r.length})]}),(0,K.jsx)(`ul`,{className:`divide-y`,children:r.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-xs hover:bg-muted/40`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.primary}),e.secondary&&(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.secondary})]})},e.id))})]}):null}function Ut({board:e,onSelectTask:t}){let{t:n}=m(),r=(0,z.useMemo)(()=>yt(e),[e]);return(0,K.jsxs)(`div`,{className:`h-full space-y-4 overflow-y-auto p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4 rounded-md border bg-background p-4`,children:[(0,K.jsx)(Ee,{pct:r.gradedTasks?r.passed/r.gradedTasks*100:0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold`,children:n(`activity:kanban.definitionOfDone`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.passed,` of `,r.gradedTasks,` graded tasks verified passed ·`,` `,r.totalTasks,` tasks total`]})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[(0,K.jsx)(Vt,{label:`verified`,value:r.passed,tone:`success`}),(0,K.jsx)(Vt,{label:`failed`,value:r.failed,tone:`destructive`}),(0,K.jsx)(Vt,{label:n(`activity:verifyReport.verdictNeedsHuman`),value:r.needsHuman,tone:`warning`}),(0,K.jsx)(Vt,{label:`incomplete`,value:r.incomplete,tone:`warning`}),(0,K.jsx)(Vt,{label:`unverified`,value:r.unverified,tone:`muted`})]}),(0,K.jsx)(Ht,{title:n(`activity:kanban.failingChecks`),icon:fe,tone:`text-destructive`,onSelectTask:t,rows:r.failingChecks.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:`${t.description}${t.error?` — ${t.error}`:``}`}))}),(0,K.jsx)(Ht,{title:n(`activity:kanban.evidenceMissing`),icon:p,tone:`text-warning`,onSelectTask:t,rows:r.missingEvidence.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:t.description}))}),(0,K.jsx)(Ht,{title:n(`activity:kanban.needsDecomposition`),icon:O,tone:`text-warning`,onSelectTask:t,rows:r.needsDecomposition.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`atomicity score ${e.atomicityAssessment?.score??`?`} — split before dispatch`}))}),(0,K.jsx)(Ht,{title:n(`activity:kanban.decompositionPending`),icon:T,tone:`text-info`,onSelectTask:t,rows:r.pendingProposals.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`${e.decomposition?.proposedSubtasks.length??0} proposed subtasks`}))}),r.failingChecks.length===0&&r.missingEvidence.length===0&&r.needsDecomposition.length===0&&r.pendingProposals.length===0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-success/30 bg-success/5 p-3 text-xs text-success`,children:[(0,K.jsx)(E,{size:14}),n(`activity:kanban.noOutstanding`)]})]})}var Wt={assigned:`bg-info/10 text-info`,queued:`bg-info/10 text-info`,running:`bg-warning/10 text-warning`,completed:`bg-success/10 text-success`,failed:`bg-destructive/10 text-destructive`,cancelled:`bg-muted text-muted-foreground`};function Gt(e,t){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=t?Date.parse(t):Date.now();if(Number.isNaN(r))return null;let i=Math.max(0,Math.round((r-n)/1e3));if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${i%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function Kt({assignment:e}){let{t}=m(),n=e.status===`running`,r=Gt(e.dispatchedAt,e.completedAt),i=q(e.name)??q(e.agentId),a=q(e.role),o=q(e.provider),s=q(e.model),c=[];return i&&c.push({label:t(`activity:kanbanRun.agent`),value:i}),a&&c.push({label:t(`activity:kanbanRun.role`),value:a}),e.modelRouting&&c.push({label:t(`activity:kanbanRun.modelSource`),value:e.modelRouting}),(o||s)&&c.push({label:t(`activity:kanbanRun.model`),value:(0,K.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[o?`${o}/`:``,s??`—`]})}),e.subagentId&&c.push({label:t(`activity:kanban.subagent`),value:(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),r&&c.push({label:e.completedAt?t(`activity:kanban.duration`):t(`activity:kanban.elapsed`),value:r}),typeof e.attempt==`number`&&c.push({label:t(`activity:kanbanRun.attempt`),value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&c.push({label:t(`activity:kanbanRun.costCeiling`),value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&c.push({label:t(`activity:kanbanRun.fallbackProfile`),value:e.fallbackProfile}),e.fallbackModels?.length&&c.push({label:t(`activity:kanbanRun.fallbacks`),value:e.fallbackModels.join(` → `)}),e.skills?.length&&c.push({label:t(`activity:kanbanRun.skills`),value:e.skills.join(`, `)}),e.tools?.length&&c.push({label:t(`activity:kanbanRun.tools`),value:e.tools.join(`, `)}),e.leaseExpiresAt&&c.push({label:t(`activity:kanbanRun.leaseExpires`),value:new Date(e.leaseExpiresAt).toLocaleString()}),(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:kanban.liveRun`)}),(0,K.jsxs)(`span`,{className:I(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,Wt[e.status]??`bg-muted text-muted-foreground`),children:[n&&(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),c.length>0&&(0,K.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:c.map(e=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,K.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,K.jsxs)(`div`,{className:`mt-2`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:t(`activity:kanban.lastResult`)}),(0,K.jsx)(`div`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap rounded bg-muted px-2 py-1 text-[11px] leading-relaxed text-foreground`,children:e.lastResult})]}),e.error&&(0,K.jsx)(`div`,{className:`mt-2 rounded border border-destructive/30 bg-destructive/10 px-2 py-1 text-[11px] text-destructive`,children:e.error})]})}function qt({activityKind:e,activityOutcome:t,note:n,details:r,onActivityKindChange:a,onActivityOutcomeChange:o,onNoteChange:s,onDetailsChange:c,onRecordActivity:l}){let{t:u}=m();return(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:u(`activity:kanbanRecorder.recordDecisionOutcome`)}),(0,K.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,K.jsx)(`select`,{value:e,onChange:e=>a(e.target.value),"aria-label":u(`activity:kanbanRecorder.taskActivityKind`),className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`decision`,`attempt`,`result`,`blocker`,`observation`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))}),(0,K.jsx)(`select`,{value:t,onChange:e=>o(e.target.value),"aria-label":u(`activity:kanbanRecorder.taskActivityOutcome`),className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`unknown`,`succeeded`,`failed`,`partial`,`skipped`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]}),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{value:n,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&l(),placeholder:u(`activity:kanbanRecorder.whatWasDecidedAttemptedOrProduced`),className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:l,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":u(`activity:kanbanRecorder.recordTaskDecisionOrOutcome`),children:(0,K.jsx)(i,{size:14})})]}),(0,K.jsx)(`input`,{value:r,onChange:e=>c(e.target.value),placeholder:u(`activity:kanbanRecorder.optionalEvidenceRationaleCommandLinkOrFailureDetail`),"aria-label":u(`activity:kanbanRecorder.taskActivityDetails`),className:`mt-1.5 h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`})]})}function Jt({board:e,task:n,newCheck:r,onNewCheckChange:a,onAddCheck:o,sendKanban:s}){let{t:c}=m();return(0,K.jsxs)(`div`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:c(`activity:kanbanTaskCompletionChecks.completionChecks`)}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(n.successCriteria??[]).map(r=>(0,K.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_92px] items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs`,children:[(0,K.jsx)(t,{size:13,className:r.status===`passed`?`text-success`:`text-muted-foreground`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:r.description}),(0,K.jsx)(`select`,{value:r.status,onChange:t=>s(`kanban.task.check.update`,{boardId:e?.id,taskId:n.id,checkId:r.id,status:t.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]},r.id)),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{value:r,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&o(),placeholder:c(`activity:kanbanTaskCompletionChecks.addAVerifiableCompletionCheck`),className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,K.jsx)(i,{size:14})})]})]})]})}var Yt=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Xt=[{value:`fs.read`,label:`Read files`,description:`fs.read`},{value:`fs.write`,label:`Write files (in project)`,description:`fs.write`},{value:`fs.write.outside-project`,label:`Write outside project`,description:`fs.write.outside-project`},{value:`net.outbound`,label:`Outbound network`,description:`net.outbound`},{value:`shell.exec`,label:`Run project commands`,description:`shell.exec`},{value:`shell.restricted`,label:`Restricted shell`,description:`shell.restricted`},{value:`shell.arbitrary`,label:`Arbitrary shell`,description:`shell.arbitrary`},{value:`session.todo`,label:`Session todos`,description:`session.todo`},{value:`tool.meta`,label:`Tool metadata`,description:`tool.meta`},{value:`tool.mutate.any`,label:`Invoke any tool`,description:`tool.mutate.any`},{value:`memory.read`,label:`Read memory`,description:`memory.read`},{value:`memory.write`,label:`Write memory`,description:`memory.write`},{value:`package.install`,label:`Install packages`,description:`package.install`},{value:`subagent.spawn`,label:`Spawn subagents`,description:`subagent.spawn`},{value:`config.mutate`,label:`Mutate config / trust`,description:`config.mutate`}];function Zt(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function Qt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function $t(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?Y(Qt(e.after).outcome)===`failed`?`failures`:e.type===`task.activity.attempt`?`execution`:`notes`:e.type.includes(`failed`)||e.type.includes(`cancelled`)?`failures`:e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type.startsWith(`task.assignment.`)||e.type===`task.stale_recovered`?`execution`:e.type.includes(`note`)||e.type.includes(`check`)||e.type.includes(`metric`)?`notes`:`changes`}function en(e){let t=Qt(e.before),n=Qt(e.after);return[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>JSON.stringify(t[e])!==JSON.stringify(n[e])).map(e=>({field:e,before:t[e],after:n[e]}))}function tn(e){if(e.type.startsWith(`task.file.`))return`File ${e.type.slice(10)}`.replace(/\b\w/g,e=>e.toUpperCase());if(e.type.startsWith(`task.activity.`))return`Recorded ${e.type.slice(14)}`.replace(/\b\w/g,e=>e.toUpperCase());switch(e.type){case`task.created`:return`Task created`;case`task.copied`:return`Task copied`;case`task.updated`:return`Task contract updated`;case`task.moved`:return`Task moved`;case`task.assigned`:return`Agent assigned`;case`task.claimed`:return`Task claimed`;case`task.released`:return`Assignment released`;case`task.assignment.updated`:return`Assignment updated`;case`task.assignment.running`:return`Agent started work`;case`task.assignment.completed`:return`Agent completed work`;case`task.assignment.failed`:return`Agent run failed`;case`task.assignment.cancelled`:return`Agent run cancelled`;case`task.assignment.heartbeat`:return`Agent heartbeat`;case`task.note.added`:return`Operator note added`;case`task.check.added`:return`Acceptance check added`;case`task.check.updated`:return`Acceptance check updated`;case`task.metric.added`:return`Goal metric added`;case`task.metric.updated`:return`Goal metric updated`;case`task.lifecycle.transition`:return`Lifecycle advanced`;case`task.assignment.snapshot`:return`Current assignment observed`;case`task.stale_recovered`:return`Stale assignment recovered`;case`task.reconciled`:return`Task state reconciled`;default:return e.type.replace(/^task\./,``).replaceAll(`.`,` `).replace(/\b\w/g,e=>e.toUpperCase())}}function nn(e){let t=Qt(e.before),n=Qt(e.after);if(e.type.startsWith(`task.file.`)){let e=Y(n.filePath),t=Y(n.toolName),r=typeof n.durationMs==`number`?n.durationMs:void 0,i=typeof n.lines==`number`?n.lines:void 0;return[e,t?`tool:${t}`:void 0,r===void 0?void 0:`${r}ms`,i===void 0?void 0:`${i} lines`].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.activity.`))return[Y(n.outcome),Y(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=Y(t.columnId),r=Y(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=en(e);if(t.length)return`${t.length} field${t.length===1?``:`s`} changed: ${t.map(e=>e.field).join(`, `)}`}if(e.type===`task.lifecycle.transition`){let e=Y(t.stage),r=Y(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=Y(n.name)??Y(n.agentId)??Y(n.role),t=Y(n.provider),r=Y(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[Y(n.description),Y(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[Y(n.name),Y(n.status)].filter(Boolean).join(` · `)||void 0}function rn(e){let t=e.type;return Y(Qt(e.after).outcome)===`failed`||t.includes(`failed`)||t.includes(`cancelled`)?`bg-destructive ring-destructive/20`:t.includes(`completed`)||t.includes(`reconciled`)?`bg-success ring-success/20`:t.includes(`running`)||t.includes(`claimed`)||t.includes(`assigned`)?`bg-info ring-info/20`:t.includes(`note`)?`bg-warning ring-warning/20`:`bg-primary ring-primary/20`}function an(e){let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(t):e}function on(e){if(e===void 0)return`unset`;if(e===null)return`none`;if(typeof e==`string`)return e||`empty`;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function sn(e,t,n){let r=t.filter(t=>t.taskId===e.id).map(e=>({...e}));(e=>r.some(t=>t.type===e))(`task.created`)||r.push({id:`created:${e.id}`,boardId:``,taskId:e.id,type:`task.created`,ts:e.createdAt,...n?{sessionId:n}:{},after:{title:e.title,status:`created`,columnId:e.columnId}});for(let[t,i]of(e.lifecycle?.history??[]).entries())r.some(e=>e.type===`task.lifecycle.transition`&&e.ts===i.at&&e.actor===i.actor)||r.push({id:`lifecycle:${e.id}:${t}`,boardId:``,taskId:e.id,type:`task.lifecycle.transition`,ts:i.at,actor:i.actor,...n?{sessionId:n}:{},before:i.from?{stage:i.from}:void 0,after:{stage:i.to,action:i.action,attachment:i.attachment},note:i.comment});for(let t of e.notes??[])r.some(e=>e.type===`task.note.added`&&e.note===t.content&&Math.abs(Date.parse(e.ts)-Date.parse(t.createdAt))<2e3)||r.push({id:`note:${t.id}`,boardId:``,taskId:e.id,type:`task.note.added`,ts:t.createdAt,actor:t.author,...n?{sessionId:n}:{},note:t.content});let i=r.some(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`));return e.assignment&&!i&&r.push({id:`assignment:${e.id}`,boardId:``,taskId:e.id,type:`task.assignment.snapshot`,ts:e.assignment.completedAt??e.assignment.dispatchedAt??e.assignment.claimedAt??e.updatedAt,actor:e.assignment.agentId??e.assignment.name??e.assignment.role,...n?{sessionId:n}:{},subagentId:e.assignment.subagentId,runTaskId:e.assignment.runTaskId,after:{...e.assignment},note:e.assignment.error??e.assignment.lastResult}),r.sort((e,t)=>t.ts.localeCompare(e.ts))}function cn({event:e}){let t=Qt(e.after),n=Y(t.provider),r=Y(t.model),i=Y(t.modelRouting),a=Y(t.fallbackProfile),o=Array.isArray(t.fallbackModels)?t.fallbackModels.filter(e=>typeof e==`string`):[],s=typeof t.attempt==`number`?t.attempt:void 0,c=typeof t.maxAttempts==`number`?t.maxAttempts:void 0,l=Y(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,K.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`fallback-`,t+1,`:`,e]},`${e}:${t}`)),s!==void 0&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function ln({task:e,events:n,sessionId:r,loading:i=!1,error:a,onRefresh:o}){let{t:s}=m(),[c,l]=(0,z.useState)(`all`),[u,d]=(0,z.useState)(``),[p,h]=(0,z.useState)(!1),g=(0,z.useMemo)(()=>sn(e,n,r),[e,n,r]),v=(0,z.useMemo)(()=>({all:g.length,execution:g.filter(e=>$t(e)===`execution`).length,changes:g.filter(e=>$t(e)===`changes`).length,notes:g.filter(e=>$t(e)===`notes`).length,failures:g.filter(e=>$t(e)===`failures`).length}),[g]),y=(0,z.useMemo)(()=>{let e=u.trim().toLowerCase();return g.filter(t=>c!==`all`&&$t(t)!==c?!1:!e||[tn(t),t.type,t.actor,t.sessionId,t.subagentId,t.runTaskId,t.note,JSON.stringify(t.before),JSON.stringify(t.after)].filter(Boolean).join(` `).toLowerCase().includes(e))},[g,c,u]),b=L(y,50,`${c}:${u}`),x=b.pageItems,S=[...new Set(g.map(e=>e.actor).filter(Boolean))].length,C=[...new Set(g.map(e=>e.sessionId??r).filter(Boolean))].length;return(0,K.jsxs)(`section`,{"aria-label":s(`activity:taskTimeline.taskActivity`),className:`mt-5`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(f,{className:`size-3.5 text-primary`}),(0,K.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:s(`activity:taskTimeline.activityLedger`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground`,children:[y.length,`/`,g.length]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(Zt(e,y,`filtered`),null,2)),h(!0)}catch{h(!1)}},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.copyVisibleTaskActivityJson`),title:s(`activity:taskTimeline.copyFilteredActivityJson`),children:p?(0,K.jsx)(t,{className:`size-3 text-success`}):(0,K.jsx)(_,{className:`size-3`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Zt(e,g,`full`),null,2),n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${e.title.replace(/[^a-z0-9]+/gi,`-`).replace(/^-|-$/g,``).toLowerCase()||e.id}-activity.json`,r.click(),URL.revokeObjectURL(n)},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.downloadFullTaskActivityJson`),title:s(`activity:taskTimeline.downloadFullActivityJson`),children:(0,K.jsx)(j,{className:`size-3`})}),o&&(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.refreshTaskActivity`),children:(0,K.jsx)(he,{className:I(`size-3`,i&&`animate-spin`)})})]})]}),(0,K.jsx)(`div`,{className:`mb-2 grid grid-cols-4 gap-px overflow-hidden rounded-md border border-border/60 bg-border/60 text-center`,children:[[`Events`,g.length],[`Actors`,S],[`Sessions`,C],[`Failures`,v.failures]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,K.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,K.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:I(`rounded border px-1.5 py-1 text-[9px] capitalize`,c===e?`border-primary/50 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[e,` `,v[e]]},e))}),(0,K.jsxs)(`div`,{className:`relative mb-3`,children:[(0,K.jsx)(D,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),"aria-label":s(`activity:taskTimeline.searchTaskActivity`),placeholder:s(`activity:taskTimeline.searchAgentSessionModelResultField`),className:`h-8 w-full rounded-md border bg-background pl-7 pr-7 text-[11px] outline-none focus:border-primary`}),u&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>d(``),"aria-label":s(`activity:taskTimeline.clearTaskActivitySearch`),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(k,{className:`size-3`})})]}),a&&(0,K.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] text-destructive`,children:a}),y.length===0?(0,K.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-6 text-center text-[11px] text-muted-foreground`,children:s(`activity:taskTimeline.noActivityMatchesThisFilter`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:x.map(e=>{let t=nn(e),n=e.sessionId??r,i=en(e),a=$t(e)===`failures`,o=e.type.includes(`completed`)||Y(Qt(e.after).outcome)===`succeeded`;return(0,K.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,K.jsx)(`span`,{className:I(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,rn(e))}),(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:tn(e)}),(0,K.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,K.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:an(e.ts)})]}),t&&(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,K.jsxs)(`div`,{className:I(`mt-1.5 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border px-2 py-1.5 text-[10px] leading-4`,a?`border-destructive/30 bg-destructive/5 text-destructive`:o?`border-success/30 bg-success/5 text-success`:`border-border/70 bg-muted/35 text-foreground`),children:[(0,K.jsxs)(`strong`,{children:[a?`Error`:o?`Result`:`Reason / result`,`:`]}),` `,e.note]}),i.length>0&&e.type!==`task.assigned`&&e.type!==`task.assignment.snapshot`&&!e.type.startsWith(`task.file.`)&&(0,K.jsx)(`div`,{className:`mt-1.5 space-y-1 rounded border border-border/60 bg-background/50 p-1.5`,children:i.map(e=>(0,K.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,K.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,K.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`line-through opacity-70`,children:on(e.before)}),` `,(0,K.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,K.jsx)(`span`,{className:`text-foreground`,children:on(e.after)})]})]},e.field))}),(0,K.jsx)(cn,{event:e}),(e.actor||n||e.subagentId||e.runTaskId||e.correlationId)&&(0,K.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),n&&(0,K.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:n,children:[`session:`,n]}),e.subagentId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,K.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:s(`activity:taskTimeline.fullEventPayload`)}),(0,K.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded border bg-muted/30 p-2 text-[9px] leading-4 text-foreground`,children:JSON.stringify(e,null,2)})]})]},e.id)})}),(0,K.jsx)(we,{page:b.page,pageSize:b.pageSize,totalItems:b.totalItems,onPageChange:b.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function un(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function dn(e){return e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type===`task.assignment.snapshot`||e.type===`task.stale_recovered`||e.type.startsWith(`task.assignment.`)}function fn(e,t){return X(t.status)||(e.type===`task.claimed`?`claimed`:e.type===`task.released`?`released`:e.type===`task.stale_recovered`?`recovered`:e.type.split(`.`).at(-1)??`unknown`)}function pn(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function mn(e,t){if(!t)return;let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):void 0}function hn(e,t,n){let r=sn(e,t,n).filter(dn).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=un(e.after),r=Number(t.attempt),c=e.type===`task.assigned`||e.type===`task.claimed`;Number.isFinite(r)&&r>0?a=Math.trunc(r):c&&(a===0||s)?a=o+1:a===0&&(a=1),o=Math.max(o,a);let l=fn(e,t),u=i.get(a)??{attempt:a,status:l,startedAt:e.ts,fallbackModels:[],sessionIds:new Set,eventCount:0};u.status=l,u.eventCount+=1,(e.sessionId??n)&&u.sessionIds.add(e.sessionId??n),u.owner=X(t.name)??X(t.agentId)??X(t.role)??e.actor??u.owner,u.provider=X(t.provider)??u.provider,u.model=X(t.model)??u.model,u.routingMode=X(t.modelRouting)??u.routingMode,u.fallbackProfile=X(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??X(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??X(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=X(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=X(t.error)??e.note??u.error),pn(l)&&(u.endedAt=e.ts),i.set(a,u),s=pn(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:mn(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function gn(e){if(e===void 0)return`running`;if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function _n(e){return e===`completed`?`bg-success/10 text-success`:e===`failed`||e===`cancelled`?`bg-destructive/10 text-destructive`:e===`running`?`bg-info/10 text-info`:`bg-muted text-muted-foreground`}function vn({task:e,events:t,sessionId:n}){let{t:r}=m(),i=hn(e,t,n),o=L(i,8,e.id);return i.length?(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(a,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:r(`activity:taskExecutionAttempts.executionAttempts`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[i.length,` total`]}),(0,K.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${_n(i[0].status)}`,children:[`latest:`,i[0].status]}),(0,K.jsx)(h,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[o.pageItems.map(e=>(0,K.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,K.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${_n(e.status)}`,children:e.status}),(0,K.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,K.jsx)(u,{className:`size-3`}),` `,gn(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(se,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,K.jsx)(A,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,K.jsxs)(`p`,{className:`mt-1.5 break-all font-mono text-[9px] text-muted-foreground`,children:[`fallback:`,[e.fallbackProfile?`profile:${e.fallbackProfile}`:``,...e.fallbackModels].filter(Boolean).join(` → `)]}),e.error&&(0,K.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[10px] text-destructive`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskExecutionAttempts.error`)}),` `,e.error]}),e.result&&(0,K.jsxs)(`p`,{className:`mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border border-success/30 bg-success/5 px-2 py-1.5 text-[10px] text-success`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskExecutionAttempts.result`)}),` `,e.result]})]},e.attempt)),(0,K.jsx)(we,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function yn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return q(e)}function bn(e,t){return(t??[]).map(t=>{let n=e.tasks.find(e=>e.id===t);return{id:t,title:n?.title??t,status:n?.status??`missing`}})}function xn(e,t,n,r,i,a,o){let s=sn(t,n,r),c=bn(e,t.dependsOn),l=c.filter(e=>![`completed`,`archived`].includes(e.status)),u=t.assignment,d=(o??e.presence??[]).filter(e=>e.taskId===t.id),f=yn(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Z(u?.modelRouting)??Z(f.modelRouting)??`session`,m=Z(u?.provider)??Z(f.provider)??(p===`session`?Z(i):void 0),h=Z(u?.model)??Z(f.model)??(p===`session`?Z(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Z).filter(e=>e!==void 0),_=Z(u?.fallbackProfile)??Z(f.fallbackProfile),v=Z(u?.name)??Z(u?.agentId)??Z(u?.role)??Z(t.assignee)??Z(t.assignedAgent)??`Unassigned`,y=t.lifecycle?.history.at(-1),b=s.find(e=>e.note&&e.type!==`task.note.added`)?.note,x=`Placed in ${e.columns.find(e=>e.id===t.columnId)?.title??t.columnId}.`;u?.error?x=`Agent run failed: ${u.error}`:l.length?x=`Blocked by ${l.map(e=>e.title).join(`, `)}.`:y?.comment?x=y.comment:b?x=b:t.status===`review`?x=`Implementation is waiting for review evidence or approval.`:t.status===`in_progress`?x=`${v} is currently working on this task.`:t.status===`completed`&&(x=`The task and its current assignment are complete.`);let S=s.map(e=>Number(yn(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,w=s.find(e=>$t(e)===`failures`),T=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${Q(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??w?.note,lastResult:u?.lastResult??T?.note,eventCount:s.length,lastActivity:s[0]}}function Q(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Sn(e,t){if(!e)return`—`;let n=Date.parse(e),r=t?Date.parse(t):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r))return`—`;let i=Math.max(0,Math.round((r-n)/6e4));return i<1?`<1m`:i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function $({label:e,value:t,mono:n=!1}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function Cn({icon:e,title:t,children:n}){return(0,K.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,K.jsxs)(`h4`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[e,t]}),(0,K.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function wn({items:e}){let{t}=m();return e.length?(0,K.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t(`activity:taskIntel.none`)})}function Tn({board:e,task:t,events:n,presence:r,sessionId:i,sessionProvider:a,sessionModel:o}){let{t:s}=m(),c=xn(e,t,n,i,a,o,r),l=t.assignment,u=t.successCriteria?.length??0,p=t.successCriteria?.filter(e=>e.status===`passed`).length??0,g=[t.parentTaskId,...t.childTaskIds??[],t.chain?.previousTaskId,t.chain?.nextTaskId,t.mergedIntoTaskId,...t.mergedFromTaskIds??[]].filter(e=>!!e),_=bn(e,[...new Set(g)]);return(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(ue,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:s(`activity:taskIntel.heading`)}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:t.status}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:s(`activity:taskIntel.eventsCount`,{count:c.eventCount})}),(0,K.jsx)(h,{className:`size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,K.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,K.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:c.column}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.stagePrefix`),t.lifecycle?.currentStage??s(`activity:taskIntel.legacyStage`)]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.priorityPrefix`),t.priority]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.typePrefix`),t.type??s(`activity:taskIntel.inferredType`)]})]}),(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,K.jsx)(`strong`,{children:s(`activity:taskIntel.whyHere`)}),` `,c.reason]}),c.blockers.length>0&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-warning`,children:s(`activity:taskIntel.unresolvedBlockers`,{count:c.blockers.length})})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,K.jsxs)(Cn,{icon:(0,K.jsx)(se,{className:`size-3`}),title:s(`activity:taskIntel.ownershipRuntime`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.owner`),value:c.owner}),(0,K.jsx)($,{label:s(`activity:taskIntel.assignee`),value:Z(t.assignee)??Z(t.assignedAgent)??`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentId`),value:Z(l?.agentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentNameRole`),value:[Z(l?.name),Z(l?.role)].filter(Boolean).join(` · `)||`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.runStatus`),value:Z(l?.status)??`unassigned`}),(0,K.jsx)($,{label:s(`activity:taskIntel.subagent`),value:Z(l?.subagentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.runTask`),value:Z(l?.runTaskId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.sessionS`),value:c.sessions.join(`, `)||`Unknown`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.usersPresence`),value:c.presence.length?c.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(A,{className:`size-3`}),title:s(`activity:taskIntel.modelRouteFallback`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.routingMode`),value:c.routingMode}),(0,K.jsx)($,{label:s(`activity:taskIntel.primary`),value:c.primaryModel,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.provider`),value:c.provider??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.model`),value:c.model??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.fallbackRoute`),value:c.fallbackRoute,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.skills`),value:l?.skills?.map(Z).filter(Boolean).join(`, `)||`Default`}),(0,K.jsx)($,{label:s(`activity:taskIntel.tools`),value:l?.tools?.map(Z).filter(Boolean).join(`, `)||`Default toolset`}),(0,K.jsx)($,{label:s(`activity:taskIntel.capabilities`),value:l?.allowedCapabilities?.map(Z).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(E,{className:`size-3`}),title:s(`activity:taskIntel.executionPolicyOutcome`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.attempts`),value:`${c.attempts}${l?.maxAttempts?` / ${l.maxAttempts}`:``}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.retryPolicy`),value:l?.retryPolicy??t.retryPolicy??`off`}),(0,K.jsx)($,{label:s(`activity:taskIntel.costCeiling`),value:(l?.costCeilingUsd??t.costCeilingUsd)==null?`Unbounded`:`$${(l?.costCeilingUsd??t.costCeilingUsd).toFixed(2)}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.failuresDone`),value:`${c.failures} / ${c.completions}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.checks`),value:`${p} / ${u} passed`}),(0,K.jsx)($,{label:s(`activity:taskIntel.lastFailure`),value:c.lastFailure??`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.result`),value:c.lastResult??`No result recorded`})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(f,{className:`size-3`}),title:s(`activity:taskIntel.timingAuditCoverage`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.created`),value:Q(t.createdAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.updated`),value:Q(t.updatedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.due`),value:Q(t.dueDate)}),(0,K.jsx)($,{label:s(`activity:taskIntel.dispatched`),value:Q(l?.dispatchedAt??l?.claimedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.completed`),value:Q(l?.completedAt??t.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.duration`),value:Sn(l?.dispatchedAt??l?.claimedAt,l?.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.heartbeat`),value:Q(l?.heartbeatAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.leaseExpires`),value:Q(l?.leaseExpiresAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.actors`),value:c.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(d,{className:`size-3`}),title:s(`activity:taskIntel.dependenciesChainProvenance`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.dependencies`),value:(0,K.jsx)(wn,{items:c.dependencies})}),(0,K.jsx)($,{label:s(`activity:taskIntel.otherRelations`),value:(0,K.jsx)(wn,{items:_})}),(0,K.jsx)($,{label:s(`activity:taskIntel.chain`),value:t.chain?`${t.chain.chainId} · position ${t.chain.order}`:`None`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.originSystem`),value:t.origin?.system??`manual`}),(0,K.jsx)($,{label:s(`activity:taskIntel.originIds`),value:t.origin&&[t.origin.graphId,t.origin.phaseId,t.origin.taskId,t.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.taskId`),value:t.id,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.boardId`),value:e.id,mono:!0})]})]})]})}var En={passed:{icon:x,labelKey:`activity:verifyReport.verdictPassed`,className:`text-success`},failed:{icon:s,labelKey:`activity:verifyReport.verdictFailed`,className:`text-destructive`},needs_human:{icon:p,labelKey:`activity:verifyReport.verdictNeedsHuman`,className:`text-warning`},incomplete:{icon:g,labelKey:`activity:verifyReport.verdictIncomplete`,className:`text-muted-foreground`}},Dn={passed:{labelKey:`activity:verifyReport.checkPassed`,className:`text-success`},failed:{labelKey:`activity:verifyReport.checkFailed`,className:`text-destructive`},skipped:{labelKey:`activity:verifyReport.checkSkipped`,className:`text-muted-foreground`},error:{labelKey:`activity:verifyReport.checkError`,className:`text-warning`}};function On(e,t){let n=Date.parse(t)-Date.parse(e);return Number.isNaN(n)||n<0?``:n<1e3?`${n}ms`:n<6e4?`${Math.round(n/1e3)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function kn({verdict:e}){let{t}=m(),n=En[e],r=n.icon;return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-semibold ${n.className}`,children:[(0,K.jsx)(r,{size:13}),t(n.labelKey)]})}function An({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,z.useState)(n);return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-2 px-3 py-2 text-xs font-semibold uppercase text-muted-foreground hover:bg-muted/50`,children:[i?(0,K.jsx)(h,{size:13}):(0,K.jsx)(C,{size:13}),(0,K.jsx)(t,{size:13}),e]}),i&&(0,K.jsx)(`div`,{className:`border-t px-3 py-2 space-y-2`,children:r})]})}function jn({check:e}){let t=Dn[e.status],{t:n}=m(),[r,i]=(0,z.useState)(!1),a=e.error||e.backingRefs?.length;return(0,K.jsxs)(`div`,{className:`rounded border bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-medium ${t.className}`,children:n(t.labelKey)}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:e.type})]}),(0,K.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:e.description})]}),a&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(!r),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:r?(0,K.jsx)(h,{size:13}):(0,K.jsx)(C,{size:13})})]}),r&&(0,K.jsxs)(`div`,{className:`mt-2 space-y-1.5 border-t pt-2`,children:[e.error&&(0,K.jsx)(`div`,{className:`rounded bg-destructive/10 px-2 py-1 text-destructive`,children:e.error}),e.backingRefs?.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(de,{size:11}),(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.path}),(0,K.jsxs)(`span`,{className:`text-[10px]`,children:[`(`,e.kind,`)`]}),e.summary&&(0,K.jsxs)(`span`,{className:`truncate`,children:[`— `,e.summary]})]},t))]})]})}function Mn({fileScope:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`activity:verifyReport.expected`),` `,(0,K.jsx)(`strong`,{children:e.expectedChanges}),` changes`]}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`activity:verifyReport.actual`),` `,(0,K.jsx)(`strong`,{children:e.actualChanges}),` changes`]}),(0,K.jsx)(`span`,{className:e.scopeMatches?`text-success`:`text-destructive`,children:e.scopeMatches?`✅ Scope matches`:`❌ Scope mismatch`})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.files.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:e.operation===`create`?`text-success`:e.operation===`delete`?`text-destructive`:`text-muted-foreground`,children:e.operation===`create`?`+`:e.operation===`delete`?`−`:`∼`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,K.jsxs)(`span`,{className:`text-[10px]`,children:[e.linesChanged,` line`,e.linesChanged===1?``:`s`]}),!e.expected&&(0,K.jsx)(`span`,{className:`rounded bg-warning/10 px-1 text-[10px] text-warning`,children:`unexpected`})]},t))})]})}function Nn({subtasks:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[t(`activity:verifyReport.total`),` `,(0,K.jsx)(`strong`,{children:e.total})]}),(0,K.jsxs)(`span`,{className:`text-success`,children:[t(`activity:verifyReport.completed`),` `,(0,K.jsx)(`strong`,{children:e.completed})]}),e.failed>0&&(0,K.jsxs)(`span`,{className:`text-destructive`,children:[t(`activity:verifyReport.failed`),` `,(0,K.jsx)(`strong`,{children:e.failed})]})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.children.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.verdict===`passed`?(0,K.jsx)(`span`,{className:`text-success`,children:`✓`}):e.verdict===`failed`?(0,K.jsx)(`span`,{className:`text-destructive`,children:`✗`}):e.verdict===`needs_human`?(0,K.jsx)(`span`,{className:`text-warning`,children:`⚠`}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`○`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},t))})]})}function Pn({attachments:e}){return(0,K.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded border bg-muted/30 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(w,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.path?(0,K.jsxs)(`span`,{className:`truncate block`,children:[e.path,(0,K.jsx)(`span`,{className:`ml-1 rounded bg-muted px-1 text-[10px]`,children:e.kind})]}):(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px]`,children:e.kind})}),e.content&&(0,K.jsxs)(`pre`,{className:`mt-1 max-h-20 overflow-auto rounded bg-background p-1 text-[10px] text-muted-foreground`,children:[e.content.slice(0,500),e.content.length>500?`
3
- …`:``]})]})]},t))})}function Fn({report:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`mt-5 space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:t(`activity:verifyReport.verificationReport`)}),(0,K.jsx)(kn,{verdict:e.verdict})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:On(e.startedAt,e.completedAt)})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground whitespace-pre-wrap`,children:e.markdownSummary}),e.checks.length>0&&(0,K.jsx)(An,{title:t(`activity:verifyReport.checkResults`),icon:te,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,K.jsx)(jn,{check:e},e.checkId))}),e.fileScope&&(0,K.jsx)(An,{title:t(`activity:verifyReport.fileScope`),icon:de,defaultOpen:!e.fileScope.scopeMatches,children:(0,K.jsx)(Mn,{fileScope:e.fileScope})}),e.subtasks&&(0,K.jsx)(An,{title:t(`activity:verifyReport.subTasks`),icon:te,children:(0,K.jsx)(Nn,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,K.jsx)(An,{title:`Attachments (${e.attachments.length})`,icon:w,children:(0,K.jsx)(Pn,{attachments:e.attachments})})]})}function In({boardId:e,task:t,sendKanban:n}){let{t:r}=m();return _t(t,ye(n=>n.verificationActivity[`${e}:${t.id}`]))===`running`?(0,K.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-md border border-info/30 bg-info/5 p-3 text-xs text-info`,children:[(0,K.jsx)(M,{size:14,className:`animate-spin`}),r(`activity:taskVerify.verificationRunningChecksAreBeingExecuted`)]}):t.verificationReport?(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(Fn,{report:t.verificationReport}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(`kanban.task.verify`,{boardId:e,taskId:t.id}),className:`mt-1.5 rounded-md border px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted`,children:r(`activity:taskVerify.reRunVerification`)})]}):(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border border-dashed p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(T,{size:14}),(0,K.jsx)(`span`,{className:`font-medium`,children:r(`activity:taskVerify.unverified`)}),(0,K.jsx)(`span`,{children:r(`activity:taskVerify.noVerificationReportExistsForThis`)})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(`kanban.task.verify`,{boardId:e,taskId:t.id}),className:`mt-2 rounded-md bg-primary/10 px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-primary/20`,children:r(`activity:taskVerify.runVerification`)})]})}function Ln({boards:e,board:t,task:r,runLink:i,onClose:a,onSelectTask:s,sendKanban:c,sendRaw:l,refreshBoard:u,activityEvents:d,activityPresence:f,activityLoading:p,activityError:g,activitySessionId:y,refreshActivity:b}){let{t:x}=m(),[S,C]=(0,z.useState)(``),[w,T]=(0,z.useState)(``),[D,te]=(0,z.useState)(``),[O,A]=(0,z.useState)(``),[j,ne]=(0,z.useState)(``),[M,ie]=(0,z.useState)(`session`),[ae,oe]=(0,z.useState)(``),[se,ce]=(0,z.useState)([]),[le,ue]=(0,z.useState)([]),[de,fe]=(0,z.useState)([]),[me,he]=(0,z.useState)([]),[N,P]=(0,z.useState)(``),ge=Se(!!r),F=Ge(!!r),_e=q(F.sessionProvider),ve=q(F.sessionModel),ye=R(`kanban-task-inspector`,!!r),[be,xe]=(0,z.useState)(!1),[L,we]=(0,z.useState)(!1),[Te,Ee]=(0,z.useState)(``),[De,B]=(0,z.useState)(``),[V,Oe]=(0,z.useState)(``),[ke,Ae]=(0,z.useState)(`pending`),[je,Me]=(0,z.useState)(``),[Ne,Pe]=(0,z.useState)(``),[Fe,Ie]=(0,z.useState)(``),[Le,Re]=(0,z.useState)(`medium`),[ze,H]=(0,z.useState)(`chore`),[Be,U]=(0,z.useState)(``),[Ve,He]=(0,z.useState)([]),[W,G]=(0,z.useState)([]),[Ue,We]=(0,z.useState)(!1),[qe,Je]=(0,z.useState)(``),[Ye,Xe]=(0,z.useState)(``),[Ze,Qe]=(0,z.useState)(`off`),[$e,et]=(0,z.useState)(``),[tt,nt]=(0,z.useState)(``),[rt,it]=(0,z.useState)(``),[at,st]=(0,z.useState)(``),[ct,lt]=(0,z.useState)(``),[ut,dt]=(0,z.useState)(`observation`),[ft,pt]=(0,z.useState)(`unknown`),[mt,gt]=(0,z.useState)(``);(0,z.useEffect)(()=>{let n=q(r?.assignment?.provider),i=q(r?.assignment?.model);C(q(r?.assignment?.agentId)??q(r?.assignedAgent)??``),T(q(r?.assignment?.name)??``),te(q(r?.assignment?.role)??``),A(n??``),ne(i??``),ie(r?.assignment?.modelRouting??(n||i?`fixed`:`session`)),oe(q(r?.assignment?.fallbackProfile)??``),ce(r?.assignment?.fallbackModels??[]),ue(r?.assignment?.skills??[]),fe(r?.assignment?.tools??[]),he(r?.assignment?.allowedCapabilities??[]),P(e.find(e=>e.id!==t?.id)?.id??``),Ee(r?.title??``),B(r?.description??``),Oe(r?.dueDate??``),Ae(r?.status??`pending`),Me(``),Pe(``),Ie(``),Re(r?.priority??`medium`),H(r?.type??`chore`),U(r?.labels?.join(`, `)??``),He(r?.dependsOn??[]),G(r?.chain&&t?t.tasks.filter(e=>e.chain?.chainId===r.chain?.chainId).sort((e,t)=>(e.chain?.order??0)-(t.chain?.order??0)).map(e=>e.id):r?[r.id]:[]),We(!1),Je(r?.estimatedHours?.toString()??``),Xe(r?.actualHours?.toString()??``),Qe(r?.retryPolicy??r?.assignment?.retryPolicy??`off`),et((r?.costCeilingUsd??r?.assignment?.costCeilingUsd)?.toString()??``),nt(r?.assignment?.maxAttempts?.toString()??``),it(``),st(``),lt(``),dt(`observation`),pt(`unknown`),gt(``)},[t?.id,e,r]);let _t=e=>({boardId:t?.id,taskId:r?.id,...S.trim()?{agentId:S.trim()}:{},...w.trim()?{name:w.trim()}:{},...D.trim()?{role:D.trim()}:{},modelRouting:M,...M===`fixed`&&O.trim()?{provider:O.trim()}:{},...M===`fixed`&&j.trim()?{model:j.trim()}:{},...M===`fallback_profile`&&ae.trim()?{fallbackProfile:ae.trim()}:{},fallbackModels:se,skills:le,tools:de,allowedCapabilities:me,...tt?{maxAttempts:Number(tt)}:{},...$e?{costCeilingUsd:Number($e)}:{},retryPolicy:Ze,activityNote:mt.trim()||`${x(`activity:kanban.activityNoteTemplate`,{action:x(e===`dispatch`?`activity:kanban.dispatched`:`activity:kanban.assigned`),target:w.trim()||S.trim()||D.trim()||x(`activity:kanban.configuredAgentRoute`)})}`}),vt=()=>{!t||!r||!Te.trim()||(c(`kanban.task.update`,{boardId:t.id,taskId:r.id,title:Te.trim(),description:De,dueDate:V||null,...t.lifecycle?.mode===`managed`?{}:{status:ke},priority:Le,type:ze,labels:Be.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:Ve,...r.chain&&W.length<=1?{chain:null}:{},estimatedHours:qe?Number(qe):0,actualHours:Ye?Number(Ye):0,retryPolicy:Ze,costCeilingUsd:$e?Number($e):null,activityNote:mt.trim()||`Task contract edited in WebUI.`}),W.length>1&&c(`kanban.task.chain`,{boardId:t.id,taskIds:W,enforceDependencies:Ue}),window.setTimeout(()=>u(t.id),180),gt(``))},yt=[`backlog`,`todo`,`running`,`review`,`done`],bt=r?.lifecycle?.currentStage,xt=bt?yt.indexOf(bt):-1,Tt=xt>=0&&xt<yt.length-1?yt[xt+1]:void 0;return r?(0,K.jsxs)(`aside`,{"aria-label":x(`activity:kanban.taskInspector`),"data-expanded":L?`true`:`false`,className:I(`flex max-h-[42dvh] w-full shrink-0 flex-col border-t bg-card/40 transition-[width] duration-200 ease-out md:max-h-none md:border-l md:border-t-0`,L?`fixed inset-0 z-50 h-dvh max-h-none w-screen border-0 bg-card transition-none md:w-screen md:border-0`:`md:w-[420px] xl:w-[480px]`),children:[(0,K.jsxs)(`div`,{className:I(`flex h-12 items-center gap-2 border-b px-3`,L&&`px-5`),children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:x(`activity:kanban.task`)}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:r.id.slice(0,8)})]}),(0,K.jsx)(`button`,{type:`button`,title:x(L?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-label":x(L?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-pressed":L,onClick:()=>we(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:L?(0,K.jsx)(o,{size:16}):(0,K.jsx)(ee,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:x(`common:action.close`),onClick:()=>{we(!1),a()},className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(k,{size:16})})]}),r?(0,K.jsxs)(`div`,{ref:ye,className:I(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,L&&`px-5 py-4 xl:px-7`),children:[(0,K.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,K.jsx)(ot,{title:x(`activity:kanban.taskBoundary`),value:r.boundary,inherited:t?.boundary,onSave:e=>{t&&(c(`kanban.task.update`,{boardId:t.id,taskId:r.id,boundary:e,activityNote:`Task boundary edited in WebUI.`}),window.setTimeout(()=>u(t.id),150))}}),(0,K.jsx)(J,{label:x(`activity:kanban.title`),value:Te,onChange:Ee}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.descriptionWorkingContext`)}),(0,K.jsx)(`textarea`,{value:De,onChange:e=>B(e.target.value),rows:5,className:`w-full resize-y rounded-md border bg-background px-2 py-1.5 text-xs leading-5 outline-none focus:border-primary`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,K.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:x(`activity:kanban.managedStage`)}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:r.lifecycle?.currentStage??`Backlog`})]}):(0,K.jsx)(wt,{label:x(`activity:kanban.status`),value:ke,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>Ae(e)}),(0,K.jsx)(wt,{label:x(`activity:kanban.priority`),value:Le,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Re(e)}),(0,K.jsx)(wt,{label:x(`activity:kanban.type`),value:ze,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>H(e)}),(0,K.jsx)(J,{label:x(`activity:kanban.labelsCommaSeparated`),value:Be,onChange:U})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(J,{label:x(`activity:kanban.dueDatePlaceholder`),value:V,onChange:Oe}),(0,K.jsx)(J,{label:x(`activity:kanban.estimatedHours`),value:qe,onChange:Je}),(0,K.jsx)(J,{label:x(`activity:kanban.actualHours`),value:Ye,onChange:Xe})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.dependencies`)}),(0,K.jsx)(Ke,{options:(t?.tasks??[]).filter(e=>e.id!==r.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:Ve,onChange:He,placeholder:x(`activity:kanban.selectBlockingTasks`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.taskChainSelectionOrder`)}),(0,K.jsx)(Ke,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:W,onChange:e=>G(e.includes(r.id)?e:[r.id,...e]),placeholder:x(`activity:kanban.selectSequentialChain`)}),(0,K.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:Ue,onChange:e=>We(e.target.checked)}),x(`activity:kanban.enforceChainOrder`)]})]}),(0,K.jsx)(J,{label:x(`activity:kanban.assignmentReason`),value:mt,onChange:gt}),(0,K.jsxs)(`button`,{type:`button`,onClick:vt,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,K.jsx)(pe,{size:15}),` `,x(`activity:kanbanInspector.saveTaskContract`)]}),t?.lifecycle?.mode===`managed`&&Tt&&(0,K.jsxs)(`section`,{"aria-label":x(`activity:kanban.managedLifecycle`),className:`space-y-2 rounded-md border border-primary/30 bg-primary/5 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:x(`activity:kanban.kanbanAgentTransition`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[bt,` → `,Tt,`; no stages can be skipped.`]})]}),(0,K.jsx)(E,{size:16,className:`text-primary`})]}),(0,K.jsx)(J,{label:x(`activity:kanban.completedAction`),value:Ne,onChange:Pe}),(0,K.jsx)(J,{label:x(`activity:kanban.progressComment`),value:je,onChange:Me}),(0,K.jsx)(J,{label:x(`activity:kanban.evidenceUrl`),value:Fe,onChange:Ie}),(0,K.jsxs)(`button`,{type:`button`,disabled:!je.trim(),onClick:()=>{!t||!r||!Tt||!je.trim()||(c(`kanban.task.transition`,{boardId:t.id,taskId:r.id,to:Tt,actor:S.trim()||w.trim()||r.assignee||r.assignedAgent||`webui-agent`,comment:je.trim(),...Ne.trim()?{action:Ne.trim()}:{},...Fe.trim()?{attachment:{url:Fe.trim(),type:`url`,title:`Evidence for ${r.title}`}}:{}}),window.setTimeout(()=>u(t.id),180))},className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(n,{size:15}),` Advance to `,Tt]})]})]}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Tn,{board:t,task:r,events:d,presence:f,sessionId:y,sessionProvider:_e,sessionModel:ve}),(0,K.jsx)(vn,{task:r,events:d,sessionId:y}),(0,K.jsx)(jt,{board:t,task:r,events:d})]}),(0,K.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,K.jsx)(Ct,{label:x(`activity:kanban.source`),value:r.origin?.system??`manual`}),(0,K.jsx)(Ct,{label:x(`activity:kanban.taskId`),value:r.id.slice(0,8)}),(0,K.jsx)(Ct,{label:x(`activity:kanban.run`),value:r.assignment?.status??`unassigned`}),(0,K.jsx)(Ct,{label:x(`activity:kanban.column`),value:St(t,r.columnId)})]}),r.assignment&&(0,K.jsx)(Kt,{assignment:r.assignment}),i&&r.origin?.taskId&&(0,K.jsx)(Lt,{runLink:i,runTaskId:r.origin.taskId,modelCandidates:ge,sendRaw:l}),!i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.jsx)(wt,{label:x(`activity:kanban.primaryModelSource`),value:M,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>ie(e)}),M===`session`&&(0,K.jsxs)(`div`,{className:`rounded-md border bg-info/5 px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Uses the live session model: `,_e?`${_e}/`:``,ve||`not available`,`.`]}),M===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.fixedProviderModel`)}),(0,K.jsx)(Ce,{value:j||void 0,provider:O||void 0,candidates:ge,placeholder:x(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{ne(e),A(t)}})]}),M===`fallback_profile`&&(0,K.jsx)(wt,{label:x(`activity:kanban.fallbackProfile`),value:ae,options:Object.keys(F.fallbackProfiles),placeholder:x(`activity:kanban.selectProfile`),onChange:oe}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanban.fallbackModels`)}),(0,K.jsx)(Ke,{options:ge.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:se,onChange:ce,placeholder:x(`activity:kanban.addFallbackModel`),emptyLabel:`No models — add a provider in Settings`})]}),(0,K.jsx)(wt,{label:x(`activity:kanban.role`),value:D,options:Yt,placeholder:x(`activity:kanban.selectRole`),onChange:te}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.forceLoadedIntoTheWorker`)})]}),(0,K.jsx)(Ke,{options:F.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:le,onChange:ue,placeholder:x(`activity:kanban.assignSkills`),emptyLabel:`No skills registered`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.blankFullDefaultToolset`)})]}),(0,K.jsx)(Ke,{options:F.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:de,onChange:fe,placeholder:x(`activity:kanban.restrictTools`),emptyLabel:`Tool list unavailable on this server`})]}),(0,K.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>xe(e=>!e),className:`flex w-full items-center justify-between px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[x(`activity:kanbanInspector.advanced`),(0,K.jsx)(h,{size:13,className:I(`transition-transform`,be&&`rotate-180`)})]}),be&&(0,K.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,K.jsx)(J,{label:x(`activity:kanban.agentNameOptional`),value:w,onChange:T}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(wt,{label:x(`activity:kanban.retryPolicy`),value:Ze,options:[`off`,`incremental`,`exponential`],onChange:e=>Qe(e)}),(0,K.jsx)(J,{label:x(`activity:kanban.maxAttempts`),value:tt,onChange:nt}),(0,K.jsx)(J,{label:x(`activity:kanban.costCeilingUsd`),value:$e,onChange:et})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.blankSafeDefaults`)})]}),(0,K.jsx)(Ke,{options:Xt,selected:me,onChange:he,placeholder:x(`activity:kanban.grantCapability`)})]})]})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||(c(`kanban.task.assign`,_t(`assign`)),gt(``),window.setTimeout(()=>u(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,K.jsx)(v,{size:15}),x(`activity:kanbanInspector.assign`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||(c(`kanban.task.dispatch`,_t(`dispatch`)),gt(``),window.setTimeout(()=>u(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,K.jsx)(re,{size:15}),x(`activity:kanbanInspector.dispatch`)]})]})]}),e.length>1&&!i?(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanban.targetBoard`)}),(0,K.jsx)(`select`,{value:N,onChange:e=>P(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:e.filter(e=>e.id!==t?.id).map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||!N||c(`kanban.task.copy`,{boardId:t.id,taskId:r.id,targetBoardId:N})},disabled:!N,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(_,{size:15}),x(`activity:kanbanInspector.copy`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||!N||c(`kanban.task.transfer`,{boardId:t.id,taskId:r.id,targetBoardId:N})},disabled:!N,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(n,{size:15}),x(`activity:kanbanInspector.transfer`)]})]})]}):null,(0,K.jsx)(Jt,{board:t,task:r,newCheck:rt,onNewCheckChange:it,onAddCheck:()=>{!t||!r||!rt.trim()||(c(`kanban.task.check.add`,{boardId:t.id,taskId:r.id,description:rt.trim(),checkType:`manual`}),it(``))},sendKanban:c}),t&&(0,K.jsx)(In,{boardId:t.id,task:r,sendKanban:c}),t&&(0,K.jsx)(ht,{board:t,task:r,sendKanban:c,onSelectTask:s}),(0,K.jsx)(ln,{task:r,events:d,sessionId:y,loading:p,error:g,onRefresh:b}),(0,K.jsx)(qt,{activityKind:ut,activityOutcome:ft,note:at,details:ct,onActivityKindChange:dt,onActivityOutcomeChange:pt,onNoteChange:st,onDetailsChange:lt,onRecordActivity:()=>{!t||!r||!at.trim()||(c(`kanban.task.activity.add`,{boardId:t.id,taskId:r.id,kind:ut,outcome:ft,summary:at.trim(),...ct.trim()?{details:ct.trim()}:{},actor:w.trim()||S.trim()||`webui-operator`}),st(``),lt(``),window.setTimeout(b,150))}})]}):null]}):null}var Rn=[[`board`,`Board`],[`tree`,`Tree`],[`dashboard`,`Verification`]];function zn({viewMode:e,onViewModeChange:t}){return(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-4 py-1.5`,children:Rn.map(([n,r])=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:I(`rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors`,e===n?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted`),children:r},n))})}function Bn(){let[e,t]=(0,z.useState)([]);return(0,z.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await fetch(`/api/sessions`);if(!n.ok)return;let r=await n.json();if(!Array.isArray(r)||e)return;let i=r.filter(e=>!!e&&typeof e==`object`&&typeof e.sessionId==`string`&&e.status!==`lost`).map(e=>e.sessionId).sort();t(e=>e.length===i.length&&e.every((e,t)=>e===i[t])?e:i)}catch{}};n();let r=window.setInterval(n,8e3);return()=>{e=!0,window.clearInterval(r)}},[]),e}var Vn=5e3,Hn=12;function Un({onClose:e}){let{t}=m(),n=ve(e=>e.wsUrl),r=_e(e=>e.session?.id??null),a=be(e=>e.agents),{boards:o,boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoard:d,loading:f,error:p,queueHealth:h,supervisorSnapshot:g,setLoading:v,setActiveBoardId:b}=ye(),[x,S]=(0,z.useState)(``),[C,w]=(0,z.useState)(1),T=Bn(),[ee,E]=(0,z.useState)(``),D=(0,z.useRef)(null);De(D);let[te,O]=(0,z.useState)(``),[A,j]=(0,z.useState)(null),[ne,re]=(0,z.useState)([]),[M,ie]=(0,z.useState)(),[oe,se]=(0,z.useState)(!1),[ce,le]=(0,z.useState)(null),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(null),[me,he]=(0,z.useState)(`board`),N=(0,z.useRef)(null),P=(0,z.useMemo)(()=>F(n),[n]),ge=d?.tasks.find(e=>e.id===A)??null,I=(0,z.useMemo)(()=>Qe(a.values()),[a]),xe=(0,z.useMemo)(()=>$e({sessionId:r,registrySessionIds:T,agents:a.values()}),[a,T,r]),Se=o.filter(e=>et(e,xe)),Ce=o.filter(e=>!et(e,xe)),L=(0,z.useMemo)(()=>d?Oe(d,{now:Date.now(),liveAgentIdentities:I,requireDueDate:d.lifecycle?.mode===`managed`}):null,[d,I]),we=(0,z.useMemo)(()=>tt(d),[d]),R=(e,t={})=>{v(!0),P.send({type:e,payload:t})},Te=(e,t={})=>{P.send({type:e,payload:t})},Ee=(0,z.useMemo)(()=>nt(d),[d]),B=(e=C)=>R(`kanban.list`,{page:e,pageSize:Hn,activeSessionIds:xe}),V=(e=u)=>{e&&R(`kanban.get`,{boardId:e})};(0,z.useEffect)(()=>{B()},[]),(0,z.useEffect)(()=>{let e=r?o.find(e=>e.tags?.includes(`session:${r}`)):void 0,t=!!(r&&e)&&N.current!==r,n=t?e:u?void 0:o[0];n?.id&&(t&&(N.current=r),b(n.id),R(`kanban.get`,{boardId:n.id}))},[o,u,r,b]),(0,z.useEffect)(()=>{d&&A&&!d.tasks.some(e=>e.id===A)&&j(null)},[d,A]),(0,z.useEffect)(()=>{u&&(R(`kanban.health`,{boardId:u}),R(`kanban.supervisor.status`,{boardId:u}))},[u]),(0,z.useEffect)(()=>{if(!u)return;let e=setInterval(()=>{P.send({type:`kanban.get`,payload:{boardId:u}}),P.send({type:`kanban.health`,payload:{boardId:u}})},5e3);return()=>clearInterval(e)},[u,P]),(0,z.useEffect)(()=>{let e=setInterval(()=>{P.send({type:`kanban.list`,payload:{page:C,pageSize:Hn,activeSessionIds:xe}})},8e3);return()=>clearInterval(e)},[xe,C,P]);let ke=e=>{w(e),b(null),B(e)};(0,z.useEffect)(()=>{ie(void 0)},[u,A]),(0,z.useEffect)(()=>{if(!u||!A)return;let e=u,t=A;se(!0),le(null);let n=P.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){le(r.error??`Task activity could not be loaded.`),se(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(re(r.data.events??[]),ie(r.data.presence??[]),se(!1))});return P.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Vn}}),n},[u,A,ge?.updatedAt,ue,P]),(0,z.useEffect)(()=>{if(!(!u||!A))return P.on.bind(P)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===u&&t.taskId===A&&de(e=>e+1)})},[u,A,P]);let Ae=()=>{let e=x.trim();e&&(S(``),R(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},je=()=>{if(!d)return;let e=ee.trim();e&&(E(``),R(`kanban.task.add`,{boardId:d.id,title:e,columnId:d.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>V(d.id),150))},Me=()=>{if(!d)return;let e=te.trim();e&&(O(``),R(`kanban.column.add`,{boardId:d.id,title:e}),window.setTimeout(()=>V(d.id),150))},Ne=()=>{d&&(R(`kanban.delete`,{boardId:d.id}),window.setTimeout(B,150))},Pe=()=>{d&&(R(`kanban.duplicate`,{boardId:d.id,title:`${d.title} Copy`}),window.setTimeout(B,150))},Fe=e=>{d&&(R(`kanban.task.remove`,{boardId:d.id,taskId:e.id}),window.setTimeout(()=>V(d.id),150))},Ie=(e,t)=>{if(!d)return;let n=d.tasks.find(t=>t.id===e),r=d.columns.find(e=>e.id===n?.columnId)?.title,i=d.columns.find(e=>e.id===t)?.title??t;R(`kanban.task.move`,{boardId:d.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>V(d.id),150)};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,K.jsx)(rt,{boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoards:Se,orphanedBoards:Ce,boardPage:C,boardPageSize:Hn,loading:f,newBoardTitle:x,onClose:e,onRefresh:()=>B(),onNewBoardTitleChange:S,onCreateBoard:Ae,onBoardSelect:e=>{b(e),R(`kanban.get`,{boardId:e})},onBoardPageChange:ke}),(0,K.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`header`,{className:`flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4`,children:[(0,K.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:d?.title??`No board selected`}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:d?`${d.columns.length} columns / ${d.tasks.length} tasks`:`Create or select a board`})]}),d&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{value:ee,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&je()},placeholder:t(`activity:kanban.newTask`),className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-56`}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.addTask`),onClick:je,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(i,{size:16})}),(0,K.jsx)(`input`,{value:te,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Me()},placeholder:t(`activity:kanban.newColumn`),className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-44`}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.addColumn`),onClick:Me,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex`,children:(0,K.jsx)(y,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.duplicateBoard`),onClick:Pe,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(_,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.deleteBoard`),onClick:Ne,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive sm:flex`,children:(0,K.jsx)(ae,{size:16})})]})]}),d&&(0,K.jsx)(Ye,{presence:d.presence}),d&&(0,K.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,K.jsx)(ot,{title:t(`activity:kanban.boardBoundary`),value:d.boundary,onSave:e=>{R(`kanban.update`,{boardId:d.id,boundary:e}),window.setTimeout(()=>V(d.id),150)}})}),d&&Ee&&(0,K.jsx)(Ft,{runLink:Ee,sendRaw:Te}),d&&!Ee&&d.tasks.length>0&&(0,K.jsx)(It,{boardId:d.id,sendKanban:R}),d&&(0,K.jsx)(Xe,{board:d,snapshot:g,sendKanban:R}),L&&(0,K.jsx)(ut,{audit:L,onSelectTask:j}),d&&(0,K.jsx)(ft,{board:d,sendKanban:R,onSelectTask:j}),d&&(0,K.jsx)(zn,{viewMode:me,onViewModeChange:he}),p&&(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 text-sm text-destructive`,children:[(0,K.jsx)(k,{size:15}),(0,K.jsx)(`span`,{className:`truncate`,children:p})]}),(0,K.jsx)(`div`,{ref:D,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:d?(0,K.jsxs)(K.Fragment,{children:[h&&(0,K.jsx)(Pt,{queueHealth:h,runningCostTotal:we}),me===`tree`?(0,K.jsx)(Bt,{board:d,selectedTaskId:A,onSelectTask:j}):me===`dashboard`?(0,K.jsx)(Ut,{board:d,onSelectTask:j}):(0,K.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...d.columns].sort((e,t)=>e.order-t.order).map(e=>(0,K.jsx)(Nt,{board:d,column:e,selectedTaskId:A,dragTaskId:fe,setDragTaskId:pe,onSelectTask:j,onDeleteTask:Fe,onMoveTask:Ie},e.id))})]}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:t(`activity:kanban.noBoardSelected`)})})]}),(0,K.jsx)(Ln,{boards:o,board:d,task:ge,runLink:Ee,onClose:()=>j(null),onSelectTask:j,sendKanban:R,sendRaw:Te,refreshBoard:V,activityEvents:ne,activityPresence:M,activityLoading:oe,activityError:ce,activitySessionId:d?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>de(e=>e+1)})]})}export{Un as KanbanView};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryManager-BgcicCyg.js","assets/rolldown-runtime-QTnfLwEv.js","assets/vendor-BuarzSSb.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css","assets/i18n-C31PI0Up.js","assets/activity-Ciqcr7Ps.js","assets/chat-BSg62iwX.js","assets/commandPalette-DpaemFux.js","assets/common-COVxQ0FV.js","assets/settings-DZ-H89lu.js","assets/setup-BFcmn89w.js","assets/toasts-BL_8kH4B.js","assets/useWebSocket-DuLtH2jI.js","assets/chat-store-CtOyUCdF.js","assets/utils-B-9lSDIn.js","assets/ws-client-Bw1ixxwI.js","assets/session-store-b2KGFwkX.js","assets/codemap-activity-store-DQfjo7-j.js","assets/stores-OBoFiAKe.js","assets/mailbox-store-Bc9ER3Ph.js","assets/ui-store-CE4-TlwB.js","assets/view-navigation-DIDEcp4V.js","assets/codemap-index-store-COStDU-8.js","assets/Toaster-DSKFSuK3.js","assets/dialog-ftgTihmF.js","assets/button-Dcy288Mc.js","assets/input-fo9-BPBC.js","assets/index-D1izXztg.js","assets/ModelPicker-B3BqjJnT.js","assets/index-5IWUhPO4.css","assets/roster-ws-D6dGRfC5.js","assets/shared-KAzksK0C.js","assets/AudienceMemoryPanel-BAY2Bh8z.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Pa as t,bt as n,lr as r,lt as i,za as a}from"./vendor-BuarzSSb.js";import"./i18n-C31PI0Up.js";import{s as o}from"./monaco-BLUV5g0U.js";import{t as s}from"./utils-B-9lSDIn.js";import{D as c,E as l,O as u,T as d}from"./index-D1izXztg.js";var f=e(a(),1),p=i(),m=(0,f.lazy)(()=>o(()=>import(`./MemoryManager-BgcicCyg.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]))),h=(0,f.lazy)(()=>o(()=>import(`./AudienceMemoryPanel-BAY2Bh8z.js`).then(e=>({default:e.AudienceMemoryPanel})),__vite__mapDeps([35,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,34])));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:r},{value:`audience`,label:`activity:memoryManager.tabAudience`,hint:`activity:memoryManager.tabAudienceHint`,Icon:n}];function v({defaultValue:e=`all`}={}){let{t:n}=t();return(0,p.jsxs)(d,{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)(c,{"aria-label":n(`activity:memoryManager.lensesAria`),className:`h-9 bg-muted/40 p-1 shadow-none`,children:_.map(({value:e,label:t,hint:r,Icon:i})=>(0,p.jsxs)(u,{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:n(t)}),(0,p.jsx)(`span`,{className:`hidden font-mono text-[9px] font-normal normal-case text-muted-foreground sm:inline`,children:n(r)})]},e))})}),(0,p.jsx)(l,{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:n(`activity:memoryManager.loadingSage`)}),children:(0,p.jsx)(m,{})})}),(0,p.jsx)(l,{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:n(`activity:memoryManager.loadingAudience`)}),children:(0,p.jsx)(h,{})})})]})}export{v as SageTabs};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ai as n,Bt as r,Ct as i,Et as a,Gn as o,Gt as s,Ii as c,La as l,Nr as u,Nt as d,Oa as f,Ot as p,Pa as m,Pt as h,Qi as g,Ut as _,Wi as v,Wt as y,Xi as b,Xr as ee,Zn as x,bi as te,dt as S,hn as C,in as w,ir as T,jt as E,kn as D,la as O,lt as k,mn as A,pi as ne,ut as re,wn as j,xa as M,xt as N,za as P,zn as F}from"./vendor-BuarzSSb.js";import"./i18n-C31PI0Up.js";import{t as I}from"./useWebSocket-DuLtH2jI.js";import{t as L}from"./utils-B-9lSDIn.js";import{c as R,p as z,s as B}from"./stores-OBoFiAKe.js";import{n as ie}from"./ui-store-CE4-TlwB.js";import{o as V}from"./view-navigation-DIDEcp4V.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-ftgTihmF.js";import{t as J}from"./button-Dcy288Mc.js";import{n as ae,t as oe}from"./ModelPicker-B3BqjJnT.js";import{c as se,s as ce}from"./index-D1izXztg.js";import{a as Y,c as le,i as X,l as Z,n as ue,o as de,r as fe,s as pe,t as me,u as he}from"./progress-ring-D_d6hn_4.js";import{SpecsView as ge}from"./SpecsView-BRWSI1iV.js";var Q=e(P(),1),$=k();function _e({feed:e,now:t}){let{t:n}=m();return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,$.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,$.jsx)(f,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,$.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,$.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=X[e.kind]??X.started,i=r.icon;return(0,$.jsxs)(`div`,{className:L(`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,$.jsx)(i,{className:L(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,$.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,$.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:pe(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function ve({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:a}=m(),o=n?.mergedCommits?.length??0,s=n?.baseBranch,[c,l]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{e&&l(!1)},[e]);let u=n?.status===`running`||n?.status===`paused`,d=(0,Q.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),f=(0,Q.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,$.jsx)(q,{open:e,onOpenChange:e=>!r&&t(e),children:(0,$.jsxs)(W,{className:`sm:max-w-lg border-destructive/50`,children:[(0,$.jsxs)(H,{children:[(0,$.jsxs)(G,{className:`flex items-center gap-2`,children:[(0,$.jsx)(E,{className:`h-5 w-5 text-destructive`}),a(`activity:sdd.destroyTitle`)]}),(0,$.jsx)(K,{children:a(`activity:sdd.destroyDesc`)})]}),(0,$.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[u&&(0,$.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,$.jsx)(`span`,{children:f>0?a(`activity:sdd.stopRunAgents`,{count:f}):a(`activity:sdd.stopRun`)})]}),(0,$.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,$.jsx)(`span`,{children:d>0?a(`activity:sdd.removeWorktreesCount`,{count:d}):a(`activity:sdd.removeWorktreesAll`)})]}),(0,$.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,$.jsx)(`span`,{children:a(`activity:sdd.deleteArtifacts`)})]})]}),o>0&&(0,$.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,$.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:a(`activity:sdd.revertMerged`,{count:o})}),` `,`on `,(0,$.jsx)(`code`,{className:`text-xs`,children:s??a(`activity:sdd.baseBranchFallback`)}),(0,$.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(`activity:sdd.revertHint`)})]})]}),(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(p,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(o>0&&!c?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,$.jsxs)(U,{className:`gap-2 sm:gap-2`,children:[(0,$.jsx)(J,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:a(`common:action.cancel`)}),(0,$.jsx)(J,{size:`sm`,disabled:r,onClick:()=>i(c),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,a(`activity:sdd.destroying`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{className:`mr-1 h-3.5 w-3.5`}),` `,a(`activity:sdd.destroyAll`)]})})]})]})})}var ye=[{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 be({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=m(),i=(0,Q.useMemo)(()=>{let t=new Map;for(let e of ye)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,$.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:ye.map(e=>{let a=i.get(e.key)??[];return(0,$.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:L(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,$.jsx)(`span`,{className:L(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,$.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[a.map(e=>(0,$.jsx)(xe,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,$.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 xe({task:e,selected:n,onClick:r}){let i=e.displayStatus===`in_progress`;return(0,$.jsxs)(`button`,{type:`button`,onClick:r,className:L(`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`,n?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,i&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i&&(0,$.jsx)(T,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,$.jsx)(t,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,$.jsx)(S,{className:`h-3 w-3 text-destructive`}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,$.jsx)(`span`,{className:L(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,Z(e.priority).chip),children:e.priority})]}),(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(`span`,{className:L(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,i?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:de(e.agentName)}),(0,$.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,$.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,$.jsx)(A,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,$.jsx)(u,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function Se({task:e,allTasks:a,feed:s,now:c,expanded:l,modelCandidates:d,defaultModel:f,onClose:p,onToggleExpanded:h,onRetry:g,onReassign:v,onSetModel:y,onSetVerification:b,onCancel:ee,onDelete:te,onSplit:C,onSelectTask:w}){let{t:T}=m(),D=he(e.displayStatus),O=D.icon,k=e.displayStatus===`in_progress`,ne=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[re,j]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,ie]=(0,Q.useState)(``),[V,H]=(0,Q.useState)(!1),[U,W]=(0,Q.useState)(e.verificationCommand??``),G=()=>{N.trim()&&(v(e.id,N.trim()),j(!1),P(``))},K=()=>{let t=B.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&&(C(e.id,t),z(!1),ie(``))},q=(0,Q.useMemo)(()=>new Map(a.map(e=>[e.shortId,e])),[a]),J=(0,Q.useMemo)(()=>a.filter(t=>t.deps.includes(e.shortId)),[a,e.shortId]),ae=(0,Q.useMemo)(()=>s.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[s,e.id,e.shortId]),se=e.startedAt&&!e.completedAt?le(c-e.startedAt):e.startedAt&&e.completedAt?le(e.completedAt-e.startedAt):null;return(0,$.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:L(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,l&&`px-5 py-3`),children:[(0,$.jsx)(`button`,{type:`button`,onClick:p,className:`text-muted-foreground hover:text-foreground`,title:T(`activity:sddTask.backTitle`),children:(0,$.jsx)(M,{className:`h-4 w-4`})}),(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),h&&(0,$.jsx)(`button`,{type:`button`,onClick:h,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:T(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":T(l?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":l,children:l?(0,$.jsx)(o,{className:`h-4 w-4`}):(0,$.jsx)(x,{className:`h-4 w-4`})}),(0,$.jsxs)(`span`,{className:L(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,D.ring,D.text),children:[(0,$.jsx)(O,{className:L(`h-3 w-3`,k&&`animate-spin`)}),D.label]})]}),(0,$.jsxs)(`div`,{className:L(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,l?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,$.jsx)(`h3`,{className:L(`text-sm font-semibold leading-snug text-foreground`,l&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,$.jsx)(`span`,{className:L(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,k?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:de(e.agentName)}),(0,$.jsxs)(`div`,{className:`leading-tight`,children:[(0,$.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,$.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:T(k?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,$.jsx)(we,{label:T(`activity:sddTask.metaPriority`),children:(0,$.jsx)(`span`,{className:L(`font-medium uppercase`,Z(e.priority).text),children:e.priority})}),(0,$.jsx)(we,{label:T(`activity:sddTask.metaType`),children:e.type}),se&&(0,$.jsx)(we,{label:e.completedAt?T(`activity:sddTask.metaDuration`):T(`activity:sddTask.metaElapsed`),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(n,{className:`h-3 w-3 text-muted-foreground`}),se]})}),e.retries?(0,$.jsx)(we,{label:T(`activity:sddTask.metaRetries`),children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,$.jsx)(A,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,$.jsx)(we,{label:T(`activity:sddTask.metaWorktree`),full:!0,children:(0,$.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,$.jsx)(u,{className:`h-3 w-3 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[T(`activity:sddTask.workerModel`),!e.model&&f&&(0,$.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,T(`activity:sddTask.runDefault`,{model:f})]})]}),(0,$.jsx)(oe,{value:e.model,provider:e.provider,candidates:d,placeholder:f?T(`activity:sddTask.runDefaultPlaceholderModel`,{model:f}):T(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>y(e.id,t,n),onReset:e.model?()=>y(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,$.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,$.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[T(`activity:sddTask.verificationCmd`),(0,$.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,T(`activity:sddTask.gatesCompletion`)]})]}),V?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`input`,{value:U,onChange:e=>W(e.target.value),onKeyDown:t=>{t.key===`Enter`?(b(e.id,U.trim()||void 0),H(!1)):t.key===`Escape`&&(W(e.verificationCommand??``),H(!1))},placeholder:T(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{b(e.id,U.trim()||void 0),H(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:T(`common:action.save`)}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{W(e.verificationCommand??``),H(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.cancel`)})]})]}):e.verificationCommand?(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,$.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,$.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,$.jsx)(`button`,{type:`button`,onClick:()=>H(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.edit`)}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:T(`common:action.clear`)})]}):(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:T(`activity:sddTask.addVerify`)})]}),e.description&&(0,$.jsxs)(`div`,{className:L(l&&`col-span-2`),children:[(0,$.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:T(`activity:sddTask.description`)}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,$.jsx)(Ce,{events:ae,expanded:l}),e.deps.length>0&&(0,$.jsx)(Te,{title:T(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:q,onSelectTask:w}),J.length>0&&(0,$.jsx)(Te,{title:T(`activity:sddTask.blocks`),shortIds:J.map(e=>e.shortId),byShort:q,onSelectTask:w})]}),(0,$.jsxs)(`div`,{className:L(`border-t border-border p-2`,l&&`px-5 py-3`),children:[re?(0,$.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,$.jsx)(`input`,{value:N,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`&&G(),e.key===`Escape`&&j(!1)},placeholder:T(`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,$.jsx)(`button`,{type:`button`,onClick:G,disabled:!N.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,$.jsx)(t,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>j(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,$.jsx)(S,{className:`h-3.5 w-3.5`})})]}):F?(0,$.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:T(F===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{F===`stop`?ee(e.id):te(e.id),I(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,$.jsx)(t,{className:`h-3.5 w-3.5`}),` `,T(F===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>I(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,$.jsx)(S,{className:`h-3.5 w-3.5`})})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>g(e.id),title:T(`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,$.jsx)(A,{className:`h-3.5 w-3.5`}),` `,T(`common:action.retry`)]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>j(!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,$.jsx)(i,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.reassign`)]}),k&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>I(`stop`),title:T(`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,$.jsx)(r,{className:`h-3.5 w-3.5`}),` `,T(`common:action.stop`)]}),!k&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>z(!0),title:T(`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,$.jsx)(_,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.split`)]}),ne&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>I(`delete`),title:T(`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,$.jsx)(E,{className:`h-3.5 w-3.5`}),` `,T(`common:action.delete`)]})]}),R&&(0,$.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:T(`activity:sddTask.splitHint`)}),(0,$.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:B,onChange:e=>ie(e.target.value),placeholder:T(`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,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:K,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,$.jsx)(_,{className:`h-3.5 w-3.5`}),` `,T(`activity:sddTask.splitInto`)]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{z(!1),ie(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,$.jsx)(S,{className:`h-3.5 w-3.5`})})]})]})]})]})}function Ce({events:e,expanded:t}){let{t:n}=m();return(0,$.jsxs)(`section`,{className:L(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,$.jsx)(f,{className:`h-4 w-4 text-primary`}),(0,$.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`activity:sddTask.eventLog`)}),(0,$.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,$.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:n(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,$.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:n(`activity:sddTask.noEvents`)}):(0,$.jsx)(`div`,{className:L(`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?ee:r?d:f;return(0,$.jsxs)(`div`,{className:L(`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,$.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,$.jsx)(a,{className:L(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,$.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,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,$.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,$.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,$.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,$.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function we({label:e,children:t,full:n}){return(0,$.jsxs)(`div`,{className:L(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,$.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,$.jsx)(`div`,{className:`text-foreground`,children:t})]})}function Te({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,$.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,$.jsx)(`span`,{className:L(`h-1.5 w-1.5 rounded-full`,he(t?.displayStatus??`pending`).dot)}),(0,$.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function Ee({onClose:e}){let{t}=m(),{client:n}=I(),i=R(e=>e.snapshot),o=R(e=>e.lifecycleResult),s=R(e=>e.destroying),c=R(e=>e.setDestroying),l=R(e=>e.setLifecycleResult),[u,d]=(0,Q.useState)(()=>Date.now()),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(`graph`),[ee,x]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{n?.send?.({type:`sdd.board.get`})},[n]);let C=i&&(i.status===`running`||i.status===`paused`);(0,Q.useEffect)(()=>{if(!C)return;let e=setInterval(()=>d(Date.now()),1e3);return d(Date.now()),()=>clearInterval(e)},[C]);let w=(0,Q.useCallback)(e=>n?.send?.(e),[n]),T=(0,Q.useRef)(null),O=(0,Q.useCallback)(e=>{T.current=null,w({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[w]),k=(0,Q.useCallback)(e=>{x(!1),l(null),c(!0),C?(w({type:`sdd.board.stop`,payload:{}}),T.current={revertMerged:e,deadline:Date.now()+2e4}):O(e)},[C,w,O,c,l]);(0,Q.useEffect)(()=>{let e=T.current;e&&(!C||Date.now()>=e.deadline)&&O(e.revertMerged)},[C,i,O]);let M=(0,Q.useCallback)(()=>{l(null),w({type:`sdd.board.cleanup_worktrees`,payload:{}})},[w,l]),N=(0,Q.useCallback)(()=>{l(null),w({type:`sdd.board.rollback`,payload:{}})},[w,l]),P=(0,Q.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]),F=(0,Q.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]),B=(0,Q.useCallback)(e=>g(e),[]),V=(0,Q.useCallback)(()=>{g(null),v(!1)},[]),H=(0,Q.useCallback)(e=>w({type:`sdd.board.retry`,payload:{taskId:e}}),[w]),U=(0,Q.useCallback)(()=>w({type:`sdd.board.retry_all_failed`,payload:{}}),[w]),W=(0,Q.useCallback)((e,t)=>{let n=t.trim();n&&w({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[w]),G=(0,Q.useCallback)((e,t,n)=>w({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[w]),K=(0,Q.useCallback)((e,t)=>w({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[w]),q=(0,Q.useCallback)(e=>w({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[w]),oe=(0,Q.useCallback)(e=>{w({type:`sdd.board.delete_task`,payload:{taskId:e}}),g(null),v(!1)},[w]),se=(0,Q.useCallback)((e,t)=>{w({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),g(null),v(!1)},[w]),ce=ae(h!==null),X=(0,Q.useMemo)(()=>i?.tasks.find(e=>e.id===h)??null,[i?.tasks,h]),Z=i?.progress,pe=i?.diagnostics?.deadlockChains??[];return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,$.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(f,{className:`h-5 w-5 text-warning`}),(0,$.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:i?.title??t(`activity:sddBoard.titleFallback`)}),i&&(0,$.jsx)(`span`,{className:L(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,Y[i.status]??Y.idle),children:i.status}),i?.defaultModel&&(0,$.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,$.jsx)(te,{className:`h-3 w-3 text-primary`}),i.defaultModel]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i&&(0,$.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${i.runId}`,t=z.getState().boards.filter(t=>t.tags?.includes(e)),n=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];n&&z.getState().setActiveBoardId(n.id),ie.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,$.jsx)(f,{className:`h-3.5 w-3.5`}),` Kanban`]}),i&&(0,$.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:L(`rounded px-2 py-0.5 capitalize transition`,y===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),C&&(Z?.failed??0)>0&&(0,$.jsxs)(`button`,{type:`button`,onClick:U,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,$.jsx)(A,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:Z?.failed??0})]}),C&&(0,$.jsxs)($.Fragment,{children:[i?.status===`paused`?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>w({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,$.jsx)(j,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>w({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,$.jsx)(D,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>w({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,$.jsx)(r,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),i&&!C&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{type:`button`,onClick:M,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,$.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(i.mergedCommits?.length??0)>0&&(0,$.jsxs)(`button`,{type:`button`,onClick:N,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,$.jsx)(a,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:i.mergedCommits?.length??0})]})]}),i&&(s?(0,$.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,$.jsx)(A,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(C?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,$.jsxs)(`button`,{type:`button`,onClick:()=>x(!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,$.jsx)(E,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,$.jsx)(J,{variant:`ghost`,size:`icon`,onClick:e,children:(0,$.jsx)(S,{className:`h-4 w-4`})})]})]}),i&&Z&&(0,$.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,$.jsx)(me,{pct:Z.percentComplete}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,$.jsx)(ke,{label:t(`activity:sddBoard.statDone`),value:`${Z.completed}/${Z.total}`,color:`text-success`}),Z.inProgress>0&&(0,$.jsx)(ke,{label:t(`activity:sddBoard.statRunning`),value:Z.inProgress,color:`text-warning`}),Z.failed>0&&(0,$.jsx)(ke,{label:t(`activity:sddBoard.statFailed`),value:Z.failed,color:`text-destructive`}),(0,$.jsx)(ke,{label:t(`activity:sddBoard.statWave`),value:i.wave+1,color:`text-primary`}),C&&i.startedAt>0&&(0,$.jsx)(ke,{label:t(`activity:sddBoard.statElapsed`),value:le(u-i.startedAt),color:`text-foreground`})]}),(0,$.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:F.length===0?(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):F.map((e,t)=>(0,$.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,$.jsx)(`span`,{className:L(`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:de(e.name)}),(0,$.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),o&&(0,$.jsx)(Oe,{result:o,onDismiss:()=>l(null)}),pe.length>0&&(0,$.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,$.jsx)(p,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),pe.map(e=>(0,$.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:i?y===`graph`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{tasks:P,columns:i.columns,onTaskClick:B}),(0,$.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,$.jsx)(be,{tasks:i.tasks,selectedId:h,onTaskClick:B}):(0,$.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(re,{className:`h-10 w-10 text-primary/40`}),(0,$.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,$.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),i&&(0,$.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":_&&X?`true`:`false`,className:L(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,_&&X?`w-[min(72rem,72vw)]`:`w-80`),children:X?(0,$.jsx)(Se,{task:X,allTasks:i.tasks,feed:i.taskEvents?.[X.id]??i.feed??[],now:u,expanded:_,modelCandidates:ce,defaultModel:i.defaultModel,onClose:V,onToggleExpanded:()=>v(e=>!e),onRetry:H,onReassign:W,onSetModel:G,onSetVerification:K,onCancel:q,onDelete:oe,onSplit:se,onSelectTask:g},X.id):(0,$.jsx)(_e,{feed:i.feed??[],now:u})})]}),(0,$.jsx)(ve,{open:ee,onOpenChange:x,snapshot:i,busy:s,onConfirm:k})]})}function De(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=l.t(`activity:sddBoard.${t}`);if(!e.ok)return l.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??l.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(l.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(l.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(l.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):l.t(`activity:sddBoard.lcNothing`);return e.reason?l.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):l.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function Oe({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,$.jsxs)(`div`,{className:L(`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,$.jsx)(c,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,$.jsx)(v,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:De(e)}),(0,$.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,$.jsx)(S,{className:`h-3.5 w-3.5`})})]})}function ke({label:e,value:t,color:n}){return(0,$.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,$.jsx)(`span`,{className:L(`font-semibold tabular-nums`,n),children:t}),(0,$.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var Ae={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},je=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Me({onClose:e,onRunStarted:n}){let{t:r}=m(),{client:i}=I(),a=B(e=>e.snapshot),o=B(e=>e.agentText),c=B(e=>e.error),l=B(e=>e.startedRunId),u=B(e=>e.setStartedRunId),[d,f]=(0,Q.useState)(``),[p,_]=(0,Q.useState)(``),[v,ee]=(0,Q.useState)(!1),[x,te]=(0,Q.useState)(!0),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),[A,ne]=(0,Q.useState)(void 0),[re,j]=(0,Q.useState)(void 0),[M,N]=(0,Q.useState)([]),[P,R]=(0,Q.useState)(4),[z,ie]=(0,Q.useState)(!0),[V,H]=(0,Q.useState)(!1),U=ae(O),W=(0,Q.useCallback)(e=>i?.send?.(e),[i]),G=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{W({type:`sdd.spec.get`})},[W]),(0,Q.useEffect)(()=>{G.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[a?.answers.length??0,o]),(0,Q.useEffect)(()=>{l&&(u(null),n?.())},[n,u,l]);let K=a?.busy??!1,q=a?.phase??`idle`,Y=!!a?.sessionId,le=!!a?.resumed,X=a?.lastRunId;(0,Q.useEffect)(()=>{Y&&ee(!1)},[Y]);let de=a?.answers[a.answers.length-1]?.question??``,fe=!!a&&(a.taskCount>0||!!a.graphId||q===`task_review`||q===`executing`),pe=()=>{let e=d.trim();!e||K||v||(ee(!0),W({type:`sdd.spec.start`,payload:{goal:e}}))},me=()=>{let e=p.trim();!e||K||(W({type:`sdd.spec.message`,payload:{text:e}}),_(``))},he=()=>!K&&W({type:`sdd.spec.approve`,payload:{}}),ge=()=>{W({type:`sdd.run.start`,payload:{parallelSlots:P,worktrees:z,planDecompose:V,...A?{model:A,provider:re}:{},...M.length?{fallbackModels:M}:{}}}),k(!1)},_e=()=>{K||W({type:`sdd.spec.discard`,payload:{}})},ve=(0,Q.useMemo)(()=>(a?.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})),[a?.board]),ye=ve.length>0;return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,$.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(y,{className:`h-5 w-5 text-primary`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:a?.title||r(`activity:sddWizard.titleFallback`)}),Y&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r(`activity:sddWizard.${Ae[q]??`phaseStart`}`),q===`questioning`&&` · ${r(`activity:sddWizard.questionsSuffix`,{cur:a?.questionCount??0,max:a?.maxQuestions??0})}`,a&&a.taskCount>0?` · ${r(`activity:sddWizard.tasksSuffix`,{count:a.taskCount})}`:``]})]}),K&&(0,$.jsx)(T,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[X&&(0,$.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,$.jsx)(C,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.openLiveBoard`)]}),Y&&(0,$.jsx)(`button`,{type:`button`,onClick:_e,disabled:K,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`)}),fe&&(0,$.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>k(e=>!e),title:r(`activity:sddWizard.runCfgTitle`),className:L(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,A||M.length||V?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,$.jsx)(s,{className:`h-3.5 w-3.5`}),A||r(`activity:sddWizard.modelsLabel`)]}),(0,$.jsxs)(`button`,{type:`button`,onClick:ge,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,$.jsx)(C,{className:`h-3.5 w-3.5`}),` `,r(`activity:sddWizard.startRun`)]}),O&&(0,$.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,$.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.defaultWorkerModel`)}),(0,$.jsx)(oe,{value:A,provider:re,candidates:U,placeholder:r(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:r(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{ne(e),j(t)},onReset:A?()=>{ne(void 0),j(void 0)}:void 0}),(0,$.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.fallbackChain`)}),(0,$.jsx)(ce,{value:M,candidates:U,onChange:N}),(0,$.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:r(`activity:sddWizard.appliesToAll`)}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.parallelAgents`)}),(0,$.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:P,onChange:e=>{let t=Number.parseInt(e.target.value,10);R(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,$.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.isolateWorktrees`)}),(0,$.jsx)(`input`,{type:`checkbox`,checked:z,onChange:e=>ie(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(z?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,$.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:r(`activity:sddWizard.planDecompose`)}),(0,$.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>H(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,$.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:r(V?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,$.jsx)(J,{variant:`ghost`,size:`icon`,onClick:e,children:(0,$.jsx)(S,{className:`h-4 w-4`})})]})]}),Y&&(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:je.map((e,n)=>{let i=e===q,a=je.indexOf(q)>n;return(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsxs)(`span`,{className:L(`rounded-full px-2 py-0.5`,i?`bg-primary/15 text-primary`:a?`text-success`:`text-muted-foreground`),children:[a&&(0,$.jsx)(t,{className:`mr-0.5 inline h-3 w-3`}),r(`activity:sddWizard.${Ae[e]}`)]}),n<je.length-1&&(0,$.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,$.jsxs)(`div`,{ref:se(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[c&&(0,$.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:c}),le&&Y&&(0,$.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`)}),Y?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ye&&(0,$.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>te(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:[x?(0,$.jsx)(g,{className:`h-3.5 w-3.5`}):(0,$.jsx)(b,{className:`h-3.5 w-3.5`}),(0,$.jsx)(F,{className:`h-3.5 w-3.5`}),r(`activity:sddWizard.taskGraphSummary`,{count:a?.taskCount??0}),(0,$.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:r(x?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),x&&(0,$.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,$.jsx)(ue,{tasks:ve,columns:a?.board?.columns??[]})})]}),(0,$.jsxs)(`div`,{className:`mx-auto max-w-2xl space-y-3`,children:[a?.goal&&(0,$.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,$.jsx)(h,{className:`h-3 w-3`}),` `,r(`activity:sddWizard.goalLabel`)]}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:a.goal})]}),a?.answers.length||o&&q===`questioning`||K?(0,$.jsxs)(`div`,{className:`space-y-2.5`,children:[a?.answers.map(e=>(0,$.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,$.jsx)(Pe,{speaker:`assistant`,text:e.question}),(0,$.jsx)(Pe,{speaker:`user`,text:e.answer})]},e.question.slice(0,64))),o&&q===`questioning`&&o!==de&&(0,$.jsx)(Pe,{speaker:`assistant`,text:o}),K&&(0,$.jsx)(Pe,{speaker:`assistant`,text:``,thinking:!0})]}):null,a?.spec&&(0,$.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,$.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,$.jsx)(y,{className:`h-3.5 w-3.5 text-primary`}),a.spec.title]}),(0,$.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.spec.overview}),(0,$.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:a.spec.requirements.map(e=>(0,$.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`span`,{className:L(`shrink-0 font-mono uppercase`,Z(e.priority).text),children:e.priority[0]}),(0,$.jsx)(`span`,{children:e.description})]},`${e.priority}-${e.description.slice(0,32)}`))})]}),o&&(q===`implementation`||q===`task_review`)&&(0,$.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>D(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:[E?(0,$.jsx)(g,{className:`h-3.5 w-3.5`}):(0,$.jsx)(b,{className:`h-3.5 w-3.5`}),(0,$.jsx)(y,{className:`h-3.5 w-3.5 text-primary`}),` `,r(`activity:sddWizard.implementationPlan`)]}),E&&(0,$.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:Ne(o)})})]}),o&&q!==`questioning`&&q!==`implementation`&&q!==`task_review`&&!a?.spec&&(0,$.jsx)(Pe,{speaker:`assistant`,text:o}),(q===`spec_review`||q===`implementation`||q===`task_review`)&&(0,$.jsxs)(J,{variant:`secondary`,onClick:he,disabled:K,children:[(0,$.jsx)(t,{className:`mr-1.5 h-4 w-4`}),r(q===`spec_review`?`activity:sddWizard.approveSpec`:q===`task_review`?`activity:sddWizard.approveTasks`:`activity:sddWizard.approvePlan`)]}),(0,$.jsx)(`div`,{ref:G})]})]}):(0,$.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,$.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:r(`activity:sddWizard.goalPrompt`)}),(0,$.jsx)(`textarea`,{id:`sdd-goal`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&pe()},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,$.jsx)(J,{className:`mt-3`,onClick:pe,disabled:!d.trim()||v,children:v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,r(`activity:sddWizard.startingInterview`)]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(y,{className:`mr-1.5 h-4 w-4`}),` `,r(`activity:sddWizard.startInterview`)]})}),(0,$.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:r(`activity:sddWizard.introBody`)})]})]}),Y&&q!==`executing`&&q!==`done`&&(0,$.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 border-t bg-card px-4 py-2`,children:[(0,$.jsx)(`textarea`,{value:p,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),me())},rows:1,placeholder:r(q===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:K,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,$.jsx)(J,{size:`icon`,onClick:me,disabled:K||!p.trim(),children:(0,$.jsx)(w,{className:`h-4 w-4`})})]})]})}function Ne(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Pe({speaker:e,text:t,live:n,thinking:r}){let i=e===`user`;return(0,$.jsxs)(`div`,{className:L(`sdd-rise flex items-start gap-2`,i&&`flex-row-reverse`),children:[(0,$.jsx)(`span`,{className:L(`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,$.jsx)(N,{className:`h-3.5 w-3.5`}):(0,$.jsx)(O,{className:`h-3.5 w-3.5`})}),(0,$.jsx)(`div`,{className:L(`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,$.jsxs)(`span`,{className:`flex items-center gap-1 py-0.5`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):t})]})}var Fe=[{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function Ie(){let{t:e}=m(),[t,n]=(0,Q.useState)(`project`),r=B(e=>e.startedRunId),i=B(e=>e.setStartedRunId),a=()=>V(`chat`),o=(0,Q.useCallback)(()=>n(`board`),[]);(0,Q.useEffect)(()=>{r&&(n(`board`),i(null))},[r,i]);let s=(e,t)=>{let r;if(e.key===`ArrowLeft`&&(r=(t-1+Fe.length)%Fe.length),e.key===`ArrowRight`&&(r=(t+1)%Fe.length),e.key===`Home`&&(r=0),e.key===`End`&&(r=Fe.length-1),r===void 0)return;e.preventDefault();let i=Fe[r];i&&(n(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[r]?.focus())};return(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,$.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:Fe.map((r,i)=>{let a=t===r.id;return(0,$.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:L(`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,$.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},r.id)})}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,$.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,$.jsx)(Me,{onClose:a,onRunStarted:o})}),(0,$.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,$.jsx)(Ee,{onClose:a})}),(0,$.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,$.jsx)(ge,{onClose:a,onRunStarted:o})})]})]})}export{Ie as SddHub};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Dn as t,Er as n,La as r,Oa as i,Ot as a,Pa as o,Ri as s,Wi as c,an as l,dt as u,ft as d,ir as f,ji as p,jt as m,lt as ee,oi as h,on as te,vn as ne,wn as re,za as g,zt as _}from"./vendor-BuarzSSb.js";import"./i18n-C31PI0Up.js";import{t as v}from"./utils-B-9lSDIn.js";import"./stores-OBoFiAKe.js";import{n as y}from"./ui-store-CE4-TlwB.js";import{S as ie,v as b}from"./index-D1izXztg.js";var x=e(g(),1),S=ee(),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 r.t(`common:time.justNow`);if(n<36e5)return r.t(`common:time.minutesAgo`,{count:Math.floor(n/6e4)});if(n<864e5)return r.t(`common:time.hoursAgo`,{count:Math.floor(n/36e5)});let i=Math.floor(n/864e5);return i<7?r.t(`common:time.daysAgo`,{count:i}):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:i,label:`active`,defaultLabel:`Active`,className:`text-primary`};switch(e.outcome){case`completed`:return{icon:c,label:`completed`,defaultLabel:`Completed`,className:`text-success`};case`error`:return{icon:a,label:`error`,defaultLabel:`Error`,className:`text-destructive`};case`timeout`:return{icon:p,label:`timeout`,defaultLabel:`Timed out`,className:`text-warning`};case`aborted`:return{icon:s,label:`aborted`,defaultLabel:`Aborted`,className:`text-muted-foreground`};default:return e.endedAt?{icon:c,label:`completed`,defaultLabel:`Completed`,className:`text-success`}:{icon:n,label:`saved`,defaultLabel:`Saved session`,className:`text-muted-foreground`}}}function fe({stats:e}){let{t}=o();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:i},{label:t(`activity:sessions.stats.tools`,{defaultValue:`Tool calls`}),value:e.tools,icon:d},{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:a}].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:r,historyEntries:i,historyLoading:s,historyError:c,wsConnected:p,listSessions:ee,resumeSession:g,deleteSession:C,renameSession:w,variant:k=`sidebar`}){let{t:A}=o(),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)(m,{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:()=>ee(200),disabled:!p,title:A(`common:action.refresh`),children:s?(0,S.jsx)(f,{className:`h-3.5 w-3.5 animate-spin`}):(0,S.jsx)(ne,{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)(l,{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=>r(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:()=>r(``),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)(u,{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&&!s?(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)(l,{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 n=j.includes(e.id),r=de(e),i=r.icon,o=I===e.id,s=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:[o?(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`,r.className),title:A(`activity:sessions.status.${r.label}`,{defaultValue:r.defaultLabel}),children:(0,S.jsx)(i,{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:[s?(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans font-semibold text-primary`,children:[(0,S.jsx)(f,{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)(d,{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)(a,{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&&!o?(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)(re,{className:`h-3 w-3`}),A(`activity:sessions.resumeShort`,{defaultValue:`Resume`})]}):null,o?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)(te,{className:`h-3.5 w-3.5`})}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(e.id),"aria-pressed":n,className:v(`inline-flex h-7 w-7 items-center justify-center transition-colors hover:bg-warning/10 hover:text-warning`,n?`text-warning`:`text-muted-foreground`),title:A(n?`activity:sessions.unfavorite`:`activity:sessions.markFavorite`),children:(0,S.jsx)(_,{className:v(`h-3.5 w-3.5`,n&&`fill-current`)})}),o?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)(t,{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)(m,{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 +0,0 @@
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-C31PI0Up.js";import{t as v}from"./useWebSocket-DuLtH2jI.js";import{t as y}from"./utils-B-9lSDIn.js";import{t as b}from"./session-store-b2KGFwkX.js";import{F as x,m as S}from"./stores-OBoFiAKe.js";import{D as C,E as w,O as T,S as E,T as D,c as O}from"./index-D1izXztg.js";import{t as k}from"./SessionList-DH-ZsHmv.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)(D,{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)(C,{className:`h-9 min-h-9 justify-start border-border/75 bg-background p-0 shadow-none`,children:[(0,j.jsxs)(T,{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)(T,{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)(w,{value:`history`,className:`mt-0 min-h-0 flex-1 overflow-hidden ring-0`,children:(0,j.jsx)(R,{})}),(0,j.jsx)(w,{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),_=O(`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};