@wrongstack/webui 0.302.0 → 0.302.2
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.
- package/dist/assets/{AgentRosterView-PafACoYi.js → AgentRosterView-BwukmHoA.js} +1 -1
- package/dist/assets/{AnalyticsDashboard-D5lvkaiF.js → AnalyticsDashboard-C9aPEyov.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-DUXllPor.js → AudienceMemoryPanel-Bciki41o.js} +1 -1
- package/dist/assets/{ChangesView-CKLN6MLR.js → ChangesView-DumffowD.js} +1 -1
- package/dist/assets/{ChronicleDashboard-B8OyHq18.js → ChronicleDashboard-BYGV5twz.js} +1 -1
- package/dist/assets/CodeEditor-D2Dnax7e.js +1 -0
- package/dist/assets/{CodeMap-6L-z-L7d.js → CodeMap-DIKKs3Ux.js} +1 -1
- package/dist/assets/{ConfirmModal-B0BCqW4j.js → ConfirmModal-CdKg3EOQ.js} +1 -1
- package/dist/assets/{CronJobsPanel-B-rRYNgE.js → CronJobsPanel-CJ7Vc1Am.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-CDbBO9Ic.js → DeadCodeScanPanel-DaeHUzc5.js} +1 -1
- package/dist/assets/{DebugDashboard-RAxaJDNV.js → DebugDashboard-BI3EmXrM.js} +1 -1
- package/dist/assets/{DesignGalleryView-4kdGN1D5.js → DesignGalleryView-DMW6Ab__.js} +1 -1
- package/dist/assets/{GoalView-By18NfaK.js → GoalView-3291Hxnb.js} +1 -1
- package/dist/assets/KanbanView-CFE63A4a.js +3 -0
- package/dist/assets/{MailboxDetailView-BNyJNz-3.js → MailboxDetailView-CUTWkSyK.js} +1 -1
- package/dist/assets/MemoryDrawer-Dsy0AX6f.js +1 -0
- package/dist/assets/MemoryManager-D1kXeVE3.js +1 -0
- package/dist/assets/{ModelPicker-DwNrO_jw.js → ModelPicker-IOZSUnqM.js} +1 -1
- package/dist/assets/{OfficeMapPanel-Bo-cCLV7.js → OfficeMapPanel-Q81eioDB.js} +1 -1
- package/dist/assets/{ProcessMonitor-DPEMjjVq.js → ProcessMonitor-TGqyXxmB.js} +1 -1
- package/dist/assets/{QueuePanel-Dx9n4NZB.js → QueuePanel-5aMgQbHv.js} +1 -1
- package/dist/assets/{RefreshDebugView-On6-vb92.js → RefreshDebugView-DfBYFPEF.js} +1 -1
- package/dist/assets/{RequirementIntakeView-DpnZRVDz.js → RequirementIntakeView-CNAFKiQ3.js} +1 -1
- package/dist/assets/SageTabs-olgLJfg_.js +2 -0
- package/dist/assets/{SddHub-BMedBDDs.js → SddHub-7Z55QY-M.js} +1 -1
- package/dist/assets/SessionInspectView-CytBw7Y9.js +1 -0
- package/dist/assets/{SessionList-SsEjoeJF.js → SessionList-C3ygQN8A.js} +1 -1
- package/dist/assets/{SessionsDashboard-DYw9vuIv.js → SessionsDashboard-CridPbkX.js} +1 -1
- package/dist/assets/{SetupScreen-Mr604Nx3.js → SetupScreen-BkVjdky4.js} +1 -1
- package/dist/assets/{SkillDetailView-gt-Nm_ZI.js → SkillDetailView-Cp-xEHww.js} +1 -1
- package/dist/assets/{SpecsView-CVVQSIZZ.js → SpecsView-DUx1sgtH.js} +1 -1
- package/dist/assets/{TechStackView-BNen0ZpH.js → TechStackView-CvUiAISX.js} +1 -1
- package/dist/assets/{TerminalPanel-BByD75cu.js → TerminalPanel-Dg5hqYTA.js} +1 -1
- package/dist/assets/{Toaster-Cz-_rtgo.js → Toaster-BgN2bRJx.js} +1 -1
- package/dist/assets/{activity-B0cam54R.js → activity-BLSyJfTr.js} +1 -1
- package/dist/assets/{activity-D7dMY0Jm.js → activity-BnTQWNPX.js} +1 -1
- package/dist/assets/{activity-jOHsoosT.js → activity-BwEBEQ51.js} +1 -1
- package/dist/assets/{activity-DmdoxMAj.js → activity-C-9I3_s4.js} +1 -1
- package/dist/assets/{activity-DXNwLcwn.js → activity-CRMLR4a3.js} +1 -1
- package/dist/assets/{activity-B3FDXYFE.js → activity-CZIixoel.js} +1 -1
- package/dist/assets/{activity-IZoezahu.js → activity-Xqrt9v4z.js} +1 -1
- package/dist/assets/{i18n-ags7mYPP.js → i18n-9T7iGYgW.js} +2 -2
- package/dist/assets/{index-Doa2aJ1A.js → index-FHt-sKVF.js} +4 -4
- package/dist/assets/{progress-ring-BxJsZCnD.js → progress-ring-B9pqitSa.js} +1 -1
- package/dist/assets/{stores-Bz5nhi7q.js → stores-vuG0AaKy.js} +2 -2
- package/dist/assets/{useWebSocket-BHzEXXna.js → useWebSocket-CZSpbA3M.js} +1 -1
- package/dist/index.html +8 -8
- package/dist/index.js +11450 -11404
- package/dist/stores/kanban-store.d.ts +12 -0
- package/package.json +8 -8
- package/dist/assets/CodeEditor-BtAkdKFs.js +0 -1
- package/dist/assets/KanbanView-dyfUjpC5.js +0 -3
- package/dist/assets/MemoryManager-BbZ-1pfr.js +0 -1
- package/dist/assets/SageTabs-D5CzIKGe.js +0 -2
- package/dist/assets/SessionInspectView-Crs1g_xM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-DbxFVDwi.js";import{Ai as n,Bt as r,Cn as i,Ct as a,Et as o,Fi as s,Ii as c,La as l,Pa as u,Ti as d,Wi as f,dn as p,dt as m,gr as h,hn as g,ir as _,kn as v,lt as y,mn as b,ut as x,wn as S,za as C}from"./vendor-BuarzSSb.js";import"./i18n-ags7mYPP.js";import{t as ee}from"./useWebSocket-BHzEXXna.js";import{t as w}from"./utils-B-9lSDIn.js";import{_ as T,t as E,v as D}from"./stores-Bz5nhi7q.js";import{o as O}from"./view-navigation-DIDEcp4V.js";import{t as k}from"./button-Dcy288Mc.js";import{a as A}from"./ConfirmModal-B0BCqW4j.js";import{h as j,m as te,p as ne}from"./index-Doa2aJ1A.js";var M=e(C(),1),N=y(),P={pending:{icon:(0,N.jsx)(s,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,N.jsx)(n,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,N.jsx)(v,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,N.jsx)(c,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,N.jsx)(b,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,N.jsx)(f,{className:`w-4 h-4`}),color:`text-success`}},F={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},I={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function L(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function R({task:e,onStatusChange:t,onRetry:r,agents:i,onAssign:o,compact:s,className:c}){let{t:l}=u(),d=P[e.status],[f,p]=(0,M.useState)(!1),m=e.status===`in_progress`;return(0,N.jsxs)(`div`,{className:w(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`span`,{className:w(`mt-0.5`,d.color),role:`img`,"aria-label":m?l(`common:status.inProgress`):void 0,children:d.icon}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,N.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,F[e.priority]),children:e.priority}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.type]),children:e.type})]}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,N.jsxs)(`div`,{className:w(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,N.jsx)(n,{className:`w-3 h-3 animate-spin`,"aria-label":l(`common:status.working`)}),(0,N.jsx)(`span`,{children:e.assignee})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,N.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,N.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,N.jsxs)(`span`,{children:[`• `,L(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,N.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!s&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:l(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:l(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),o&&i&&i.length>0&&(f?(0,N.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,N.jsx)(`option`,{value:``,children:l(`activity:task.unassigned`)}),i.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:l(`activity:task.assignTitle`),children:[(0,N.jsx)(a,{className:`w-3 h-3`}),` `,l(`activity:task.assign`)]}))]})]})}var z=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],B={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function re(){let{client:e}=ee(),{t}=u(),n=T(e=>e.phases),r=T(e=>e.multiBoard),[i,a]=(0,M.useState)(`phase`),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(null),[f,m]=(0,M.useState)(0),h=Math.min(f,Math.max(0,n.length-1)),g=r?n[h]:void 0,_=(0,M.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),v=(0,M.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,M.useCallback)(t=>e?.send?.(t),[e]),b=(0,M.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,M.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,M.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,M.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,M.useCallback)(e=>{o&&y({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),l(null)},[o,y]),D=(0,M.useCallback)(e=>{o&&y({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),l(null)},[o,y]),O={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function k(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),l(null)}}}function j(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,c!==e&&l(e)},onDragLeave:()=>l(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":c===e||void 0}}return n.length===0?(0,N.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,N.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:_.length})}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`phase`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`status`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(p,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r&&g?(0,N.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,N.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:n.map((e,t)=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>m(t),className:w(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,N.jsx)(`span`,{className:`truncate`,children:e.name}),(0,N.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,N.jsx)(U,{phase:g,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]}):(0,N.jsx)(H,{phases:n,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]})}function V({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:d}=u();return(0,N.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(e.id)),className:w(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,N.jsx)(`span`,{className:w(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,B[e.status]),children:e.status})]}),(0,N.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),title:d(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,N.jsx)(i,{className:`h-4 w-4`})})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,N.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:d(`activity:board.dropHere`)}):t.map(e=>(0,N.jsx)(`div`,{...r(e.id),className:w(c===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,...n})},e.id))})]})}function H({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,N.jsx)(N.Fragment,{children:n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>(0,N.jsx)(V,{phase:e,phaseTasks:t.filter(t=>t.phaseId===e.id),callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id))}):(0,N.jsx)(W,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function U({phase:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=u();return n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,N.jsx)(V,{phase:e,phaseTasks:f,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:d,dragId:r,hoverKey:i})}):(0,N.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),c=`cell:${e.id}:${t.key}`;return(0,N.jsx)(`div`,{...s(c,()=>l(t.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===c?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,N.jsx)(`div`,{...o(e.id),className:w(r===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...a})},e.id))},t.key)})]},e.id)]})})}function W({phases:e,allTasks:t,dragId:n,hoverKey:r,callbacks:i,draggable:a,dropZone:o,dropToStatus:s}){let{t:c}=u();return(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(c=>{let l=t.filter(t=>t.phaseId===e.id&&c.match.includes(t.status)),u=`cell:${e.id}:${c.key}`;return(0,N.jsx)(`div`,{...o(u,()=>s(c.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,r===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,N.jsx)(`div`,{...a(e.id),className:w(n===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...i})},e.id))},c.key)})]},e.id))]})}function G({children:e}){return(0,N.jsx)(N.Fragment,{children:e})}function K({onClose:e}){let{client:n}=ee(),{t:a}=u(),s=T(e=>e.phases),c=T(e=>e.overallPercent),d=T(e=>e.autonomous),f=T(e=>e.title),p=T(e=>e.goal),y=T(e=>e.status),b=T(e=>e.lastError),C=T(e=>e.graphs);(0,M.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let A=E(e=>e.worktrees),P=E(e=>e.baseBranch),[F,I]=(0,M.useState)(``),[L,R]=(0,M.useState)(null),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(!0),[U,W]=(0,M.useState)(!1),[G,K]=(0,M.useState)(!1),[q,ie]=(0,M.useState)(!1),J=D(e=>e.result),Y=D(e=>e.loading),X=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(X.current&&clearTimeout(X.current),!F.trim()){D.getState().clear();return}return X.current=setTimeout(()=>{D.getState().setLoading();let e=D.getState().nextSeq();n?.send?.({type:`goal.assess`,payload:{goal:F,seq:e}})},800),()=>{X.current&&clearTimeout(X.current)}},[F,n]),(0,M.useEffect)(()=>{!F.trim()&&!L&&D.getState().clear()},[F,L]);let Z=s.length>0,ae=L!=null&&!Z;(0,M.useEffect)(()=>{Z&&R(null)},[Z]);let Q=(0,M.useCallback)(()=>{let e=F.trim();if(!e||L!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:l.t(`activity:goalRun.planningAck`)}),R(e),I(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:V,multiBoard:U,verifyTasks:G,chimeraReview:q}}),O(`chat`)},[F,L,n,V]),oe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),R(null)},[n]),se=(0,M.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),ce=(0,M.useCallback)(()=>{n?.send?.(y===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,y]),le=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),ue=(0,M.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),T.getState().clear(),R(null),I(``)},[n]),[de,$]=(0,M.useState)(!1),fe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),pe=y===`running`||y===`paused`,me=y===`stopped`||y===`completed`||y===`failed`,he=(0,M.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,N.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(h,{className:`h-5 w-5 text-muted-foreground`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold`,children:Z&&f||`Goal`}),Z&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:goalRun.summary`,{count:s.length,pct:c})})]}),Z&&(0,N.jsx)(`span`,{className:w(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,y===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:y===`paused`||y===`stopped`?`border-warning/40 bg-warning/10 text-warning`:y===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:b??void 0,children:y})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,N.jsxs)(`select`,{value:Z?C.find(e=>e.title===f)?.id??``:``,onChange:e=>he(e.target.value),title:a(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,N.jsx)(`option`,{value:``,disabled:!0,children:a(`activity:goalRun.boardsCount`,{count:C.length})}),C.map(e=>(0,N.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Z&&(0,N.jsxs)(`button`,{type:`button`,onClick:se,title:a(`activity:goalRun.toggleAutonomousTitle`),className:w(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,d?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(x,{className:`h-3.5 w-3.5`}),` `,a(d?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ce,title:a(y===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[y===`paused`?(0,N.jsx)(S,{className:`h-3.5 w-3.5`}):(0,N.jsx)(v,{className:`h-3.5 w-3.5`}),a(y===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:le,title:a(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,N.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,a(`activity:goalRun.stop`)]})]}),Z&&me&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ue,title:a(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,N.jsx)(i,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.newLabel`)]}),de?(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.revertConfirm`)}),(0,N.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:a(`common:action.yes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:a(`common:action.no`)})]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:a(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,N.jsx)(o,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.revert`)]})]}),(0,N.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,N.jsx)(m,{className:`h-4 w-4`})})]})]}),Z&&p&&(0,N.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:p})]}),Z?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,N.jsx)(re,{})}):ae?(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,N.jsx)(_,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.planning`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.planningBody`)})]}),(0,N.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:L})]}),(0,N.jsxs)(k,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,N.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,a(`common:action.cancel`)]})]})}):(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,N.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,N.jsx)(g,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.startHeading`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.startBody`)})]}),(0,N.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:a(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),Q())}}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(_,{className:`h-3 w-3 animate-spin`}),a(`activity:goalRun.assess.analyzing`)]}),!Y&&J&&!J.parseFailed&&(0,N.jsxs)(`div`,{className:w(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,J.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,N.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:J.realistic?(0,N.jsx)(`span`,{className:`text-success`,children:a(`activity:goalRun.assess.realistic`)}):(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.assess.durationConcern`)})}),J.durationClaimed&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.durationClaimed`,{duration:J.durationClaimed})}),(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:J.explanation}),J.recommendedDuration&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.recommendation`,{duration:J.recommendedDuration})}),J.concerns.length>0&&(0,N.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,N.jsx)(`p`,{className:`font-medium text-foreground/80`,children:a(`activity:goalRun.assess.concerns`)}),(0,N.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:J.concerns.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]})]}),!Y&&J?.parseFailed&&(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:a(`activity:goalRun.assess.analysisFailed`)}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>H(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.isolateLabel`)]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.multiBoardLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>K(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.verifyTasksLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:q,onChange:e=>ie(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!Y&&J&&!J.realistic&&!J.parseFailed&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>D.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:a(`activity:goalRun.assess.overrideTitle`),children:a(`activity:goalRun.assess.override`)}),(0,N.jsxs)(k,{onClick:Q,disabled:!F.trim()||L!=null||Y||!Y&&J!=null&&!J.parseFailed&&!J.realistic,className:`flex-1 gap-2`,title:F.trim()&&!Y&&J&&!J.parseFailed&&!J.realistic?a(`activity:goalRun.assess.disableTitle`):``,children:[(0,N.jsx)(S,{className:`h-4 w-4`}),a(`activity:goalRun.startButton`)]})]}),(0,N.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[a(`activity:goalRun.ctrlHint`),` ·`,` `,a(V?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),A.length>0&&(0,N.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:a(`activity:goalRun.lanes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:a(`activity:goalRun.graph`)})]}),(0,N.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,N.jsx)(ne,{}),z?(0,N.jsx)(j,{worktrees:A,baseBranch:P}):(0,N.jsx)(te,{worktrees:A,baseBranch:P})]})]})]})}export{K as GoalView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-DbxFVDwi.js";import{Ai as n,Bt as r,Cn as i,Ct as a,Et as o,Fi as s,Ii as c,La as l,Pa as u,Ti as d,Wi as f,dn as p,dt as m,gr as h,hn as g,ir as _,kn as v,lt as y,mn as b,ut as x,wn as S,za as C}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as ee}from"./useWebSocket-CZSpbA3M.js";import{t as w}from"./utils-B-9lSDIn.js";import{_ as T,t as E,v as D}from"./stores-vuG0AaKy.js";import{o as O}from"./view-navigation-DIDEcp4V.js";import{t as k}from"./button-Dcy288Mc.js";import{a as A}from"./ConfirmModal-CdKg3EOQ.js";import{h as j,m as te,p as ne}from"./index-FHt-sKVF.js";var M=e(C(),1),N=y(),P={pending:{icon:(0,N.jsx)(s,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,N.jsx)(n,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,N.jsx)(v,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,N.jsx)(c,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,N.jsx)(b,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,N.jsx)(f,{className:`w-4 h-4`}),color:`text-success`}},F={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},I={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function L(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function R({task:e,onStatusChange:t,onRetry:r,agents:i,onAssign:o,compact:s,className:c}){let{t:l}=u(),d=P[e.status],[f,p]=(0,M.useState)(!1),m=e.status===`in_progress`;return(0,N.jsxs)(`div`,{className:w(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`span`,{className:w(`mt-0.5`,d.color),role:`img`,"aria-label":m?l(`common:status.inProgress`):void 0,children:d.icon}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,N.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,F[e.priority]),children:e.priority}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.type]),children:e.type})]}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,N.jsxs)(`div`,{className:w(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,N.jsx)(n,{className:`w-3 h-3 animate-spin`,"aria-label":l(`common:status.working`)}),(0,N.jsx)(`span`,{children:e.assignee})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,N.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,N.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,N.jsxs)(`span`,{children:[`• `,L(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,N.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!s&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:l(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:l(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),o&&i&&i.length>0&&(f?(0,N.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,N.jsx)(`option`,{value:``,children:l(`activity:task.unassigned`)}),i.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:l(`activity:task.assignTitle`),children:[(0,N.jsx)(a,{className:`w-3 h-3`}),` `,l(`activity:task.assign`)]}))]})]})}var z=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],B={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function re(){let{client:e}=ee(),{t}=u(),n=T(e=>e.phases),r=T(e=>e.multiBoard),[i,a]=(0,M.useState)(`phase`),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(null),[f,m]=(0,M.useState)(0),h=Math.min(f,Math.max(0,n.length-1)),g=r?n[h]:void 0,_=(0,M.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),v=(0,M.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,M.useCallback)(t=>e?.send?.(t),[e]),b=(0,M.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,M.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,M.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,M.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,M.useCallback)(e=>{o&&y({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),l(null)},[o,y]),D=(0,M.useCallback)(e=>{o&&y({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),l(null)},[o,y]),O={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function k(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),l(null)}}}function j(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,c!==e&&l(e)},onDragLeave:()=>l(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":c===e||void 0}}return n.length===0?(0,N.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,N.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:_.length})}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`phase`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`status`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(p,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r&&g?(0,N.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,N.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:n.map((e,t)=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>m(t),className:w(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,N.jsx)(`span`,{className:`truncate`,children:e.name}),(0,N.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,N.jsx)(U,{phase:g,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]}):(0,N.jsx)(H,{phases:n,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]})}function V({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:d}=u();return(0,N.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(e.id)),className:w(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,N.jsx)(`span`,{className:w(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,B[e.status]),children:e.status})]}),(0,N.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),title:d(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,N.jsx)(i,{className:`h-4 w-4`})})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,N.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:d(`activity:board.dropHere`)}):t.map(e=>(0,N.jsx)(`div`,{...r(e.id),className:w(c===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,...n})},e.id))})]})}function H({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,N.jsx)(N.Fragment,{children:n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>(0,N.jsx)(V,{phase:e,phaseTasks:t.filter(t=>t.phaseId===e.id),callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id))}):(0,N.jsx)(W,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function U({phase:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=u();return n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,N.jsx)(V,{phase:e,phaseTasks:f,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:d,dragId:r,hoverKey:i})}):(0,N.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),c=`cell:${e.id}:${t.key}`;return(0,N.jsx)(`div`,{...s(c,()=>l(t.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===c?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,N.jsx)(`div`,{...o(e.id),className:w(r===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...a})},e.id))},t.key)})]},e.id)]})})}function W({phases:e,allTasks:t,dragId:n,hoverKey:r,callbacks:i,draggable:a,dropZone:o,dropToStatus:s}){let{t:c}=u();return(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(c=>{let l=t.filter(t=>t.phaseId===e.id&&c.match.includes(t.status)),u=`cell:${e.id}:${c.key}`;return(0,N.jsx)(`div`,{...o(u,()=>s(c.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,r===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,N.jsx)(`div`,{...a(e.id),className:w(n===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...i})},e.id))},c.key)})]},e.id))]})}function G({children:e}){return(0,N.jsx)(N.Fragment,{children:e})}function K({onClose:e}){let{client:n}=ee(),{t:a}=u(),s=T(e=>e.phases),c=T(e=>e.overallPercent),d=T(e=>e.autonomous),f=T(e=>e.title),p=T(e=>e.goal),y=T(e=>e.status),b=T(e=>e.lastError),C=T(e=>e.graphs);(0,M.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let A=E(e=>e.worktrees),P=E(e=>e.baseBranch),[F,I]=(0,M.useState)(``),[L,R]=(0,M.useState)(null),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(!0),[U,W]=(0,M.useState)(!1),[G,K]=(0,M.useState)(!1),[q,ie]=(0,M.useState)(!1),J=D(e=>e.result),Y=D(e=>e.loading),X=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(X.current&&clearTimeout(X.current),!F.trim()){D.getState().clear();return}return X.current=setTimeout(()=>{D.getState().setLoading();let e=D.getState().nextSeq();n?.send?.({type:`goal.assess`,payload:{goal:F,seq:e}})},800),()=>{X.current&&clearTimeout(X.current)}},[F,n]),(0,M.useEffect)(()=>{!F.trim()&&!L&&D.getState().clear()},[F,L]);let Z=s.length>0,ae=L!=null&&!Z;(0,M.useEffect)(()=>{Z&&R(null)},[Z]);let Q=(0,M.useCallback)(()=>{let e=F.trim();if(!e||L!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:l.t(`activity:goalRun.planningAck`)}),R(e),I(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:V,multiBoard:U,verifyTasks:G,chimeraReview:q}}),O(`chat`)},[F,L,n,V]),oe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),R(null)},[n]),se=(0,M.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),ce=(0,M.useCallback)(()=>{n?.send?.(y===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,y]),le=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),ue=(0,M.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),T.getState().clear(),R(null),I(``)},[n]),[de,$]=(0,M.useState)(!1),fe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),pe=y===`running`||y===`paused`,me=y===`stopped`||y===`completed`||y===`failed`,he=(0,M.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,N.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(h,{className:`h-5 w-5 text-muted-foreground`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold`,children:Z&&f||`Goal`}),Z&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:goalRun.summary`,{count:s.length,pct:c})})]}),Z&&(0,N.jsx)(`span`,{className:w(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,y===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:y===`paused`||y===`stopped`?`border-warning/40 bg-warning/10 text-warning`:y===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:b??void 0,children:y})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,N.jsxs)(`select`,{value:Z?C.find(e=>e.title===f)?.id??``:``,onChange:e=>he(e.target.value),title:a(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,N.jsx)(`option`,{value:``,disabled:!0,children:a(`activity:goalRun.boardsCount`,{count:C.length})}),C.map(e=>(0,N.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Z&&(0,N.jsxs)(`button`,{type:`button`,onClick:se,title:a(`activity:goalRun.toggleAutonomousTitle`),className:w(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,d?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(x,{className:`h-3.5 w-3.5`}),` `,a(d?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ce,title:a(y===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[y===`paused`?(0,N.jsx)(S,{className:`h-3.5 w-3.5`}):(0,N.jsx)(v,{className:`h-3.5 w-3.5`}),a(y===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:le,title:a(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,N.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,a(`activity:goalRun.stop`)]})]}),Z&&me&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ue,title:a(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,N.jsx)(i,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.newLabel`)]}),de?(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.revertConfirm`)}),(0,N.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:a(`common:action.yes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:a(`common:action.no`)})]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:a(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,N.jsx)(o,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.revert`)]})]}),(0,N.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,N.jsx)(m,{className:`h-4 w-4`})})]})]}),Z&&p&&(0,N.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:p})]}),Z?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,N.jsx)(re,{})}):ae?(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,N.jsx)(_,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.planning`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.planningBody`)})]}),(0,N.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:L})]}),(0,N.jsxs)(k,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,N.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,a(`common:action.cancel`)]})]})}):(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,N.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,N.jsx)(g,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.startHeading`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.startBody`)})]}),(0,N.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:a(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),Q())}}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(_,{className:`h-3 w-3 animate-spin`}),a(`activity:goalRun.assess.analyzing`)]}),!Y&&J&&!J.parseFailed&&(0,N.jsxs)(`div`,{className:w(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,J.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,N.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:J.realistic?(0,N.jsx)(`span`,{className:`text-success`,children:a(`activity:goalRun.assess.realistic`)}):(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.assess.durationConcern`)})}),J.durationClaimed&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.durationClaimed`,{duration:J.durationClaimed})}),(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:J.explanation}),J.recommendedDuration&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.recommendation`,{duration:J.recommendedDuration})}),J.concerns.length>0&&(0,N.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,N.jsx)(`p`,{className:`font-medium text-foreground/80`,children:a(`activity:goalRun.assess.concerns`)}),(0,N.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:J.concerns.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]})]}),!Y&&J?.parseFailed&&(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:a(`activity:goalRun.assess.analysisFailed`)}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>H(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.isolateLabel`)]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.multiBoardLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>K(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.verifyTasksLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:q,onChange:e=>ie(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!Y&&J&&!J.realistic&&!J.parseFailed&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>D.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:a(`activity:goalRun.assess.overrideTitle`),children:a(`activity:goalRun.assess.override`)}),(0,N.jsxs)(k,{onClick:Q,disabled:!F.trim()||L!=null||Y||!Y&&J!=null&&!J.parseFailed&&!J.realistic,className:`flex-1 gap-2`,title:F.trim()&&!Y&&J&&!J.parseFailed&&!J.realistic?a(`activity:goalRun.assess.disableTitle`):``,children:[(0,N.jsx)(S,{className:`h-4 w-4`}),a(`activity:goalRun.startButton`)]})]}),(0,N.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[a(`activity:goalRun.ctrlHint`),` ·`,` `,a(V?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),A.length>0&&(0,N.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:a(`activity:goalRun.lanes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:a(`activity:goalRun.graph`)})]}),(0,N.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,N.jsx)(ne,{}),z?(0,N.jsx)(j,{worktrees:A,baseBranch:P}):(0,N.jsx)(te,{worktrees:A,baseBranch:P})]})]})]})}export{K as GoalView};
|
|
@@ -0,0 +1,3 @@
|
|
|
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 ee,Yt as w,Zn as te,Zt as ne,an as re,ar as T,cn as E,dt as D,fn as O,gi as k,hn as A,in as ie,ir as ae,ji as oe,jt as se,kn as ce,la as le,lt as ue,mn as de,oa as fe,oi as pe,qt as me,un as he,vi as ge,vn as j,wn as M,xa as N,za as P}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as _e}from"./ws-client-TTMa0XaT.js";import{t as F}from"./utils-B-9lSDIn.js";import{t as ve}from"./session-store-Df7_hhe9.js";import{I as ye,T as be,m as xe,p as I}from"./stores-vuG0AaKy.js";import{n as Se}from"./ui-store-CE4-TlwB.js";import{n as Ce,t as L}from"./ModelPicker-IOZSUnqM.js";import{b as R,c as we,x as z}from"./index-FHt-sKVF.js";import{n as Te,t as Ee}from"./progress-ring-B9pqitSa.js";var B=e(P(),1);function De(e,t=!0){(0,B.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 Oe=4320*60*1e3,ke=new Set([`completed`,`archived`]);function Ae(e,t){let n=He(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Pe(e,t.defaultReviewStaleAfterMs??Oe),i=Ne(e),a=[];for(let o of e.tasks)ke.has(o.status)||(V(a,o,t.requireDueDate===!0),je(a,o,n),H(a,o,n,r),i.length>1&&Me(a,o,i));return a.sort(Ue),{issues:a,counts:{error:a.filter(e=>e.severity===`error`).length,warning:a.filter(e=>e.severity===`warning`).length},affectedTaskCount:new Set(a.map(e=>e.taskId)).size}}function V(e,t,n){W(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&&He(t.dueDate)===null&&G(e,t,`missing-due-date`,`warning`,`Set a due date`),!Be(t.labels)&&!Be(t.tags)&&G(e,t,`missing-labels`,`warning`,`Add labels or tags`),!Be(t.childTaskIds)&&!Be(t.subtasks)&&G(e,t,`missing-subtasks`,`warning`,`Define subtasks`),Be(t.successCriteria)||G(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function je(e,t,n){let r=t.assignment;if(!(t.status===`in_progress`||r?.status===`running`))return;let i=Le(t);if(!r||i.length===0||!W(r.leaseId)||!W(r.leaseExpiresAt)){G(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let a=He(r.leaseExpiresAt);if(a===null||a<=n){G(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}}function H(e,t,n,r){if(t.status!==`review`)return;let i=Ie(t,`review`)??He(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)=>[U(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(U(a.state)),c=i.get(U(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=>W(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(Ve(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(Ve(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(Ve(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`&&W(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=ze(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:He(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))U(r.state)!==U(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(W)}function Re(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(W(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=ze(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function U(e){return e.trim().toLowerCase()}function ze(...e){for(let t of e)if(W(t))return t.trim();return null}function W(e){return typeof e==`string`&&e.trim().length>0}function Be(e){return Array.isArray(e)&&e.length>0}function Ve(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function He(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=ye(e=>e.wsUrl),n=ye(e=>e.provider),r=ye(e=>e.model),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``);return(0,B.useEffect)(()=>{let e=_e(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,B.useEffect)(()=>{e&&_e(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}var K=ue();function q({options:e,selected:n,onChange:r,placeholder:a,emptyLabel:o}){let{t:s}=m(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.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,B.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),g=(0,B.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)(D,{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)(D,{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:F(`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 Ke(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 qe(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 Je({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:F(`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)(oe,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:Ke(e.lastSeenAt)})]},e.id))]})}function Ye({board:e,snapshot:t,sendKanban:n}){let{t:r}=m(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!0),[c,l]=(0,B.useState)(`deterministic`),[u,d]=(0,B.useState)(`session`),[p,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(``),[x,S]=(0,B.useState)([]),[C,ee]=(0,B.useState)([]),[w,te]=(0,B.useState)(10),re=Ce(i&&c===`agentic`),T=Ge(i&&c===`agentic`);(0,B.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??[]),ee(t?.skills??[]),te(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,JSON.stringify(e.supervisor)]);let E=()=>{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,w)*1e3,recoveryMode:`auto`,...c===`agentic`?{routing:t,skills:C}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},D=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)(ne,{size:13,className:D===`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,` · `,D]}),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:qe(t.lastAuditAt)}):r(`activity:kanban.notChecked`)}),(0,K.jsx)(h,{size:13,className:F(`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)(Xe,{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:w,onChange:e=>te(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:E,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,K.jsx)(he,{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)(Xe,{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)(L,{value:_||void 0,provider:p||void 0,candidates:re,placeholder:r(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{v(e),g(t)}})]}),u===`fallback_profile`&&(0,K.jsx)(Xe,{label:r(`activity:kanban.fallbackProfile`),value:y,options:Object.keys(T.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)(q,{options:T.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:C,onChange:ee,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)(q,{options:re.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:x,onChange:S,placeholder:r(`activity:kanban.optionalFallbacks`)})]})]})]})]})}function Xe({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 Ze({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)(N,{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)(j,{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 · `,a.length]}),a.map(e=>(0,K.jsx)(Qe,{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 · `,o.length]}),o.map(e=>(0,K.jsx)(Qe,{board:e,active:r===e.id,dotClassName:`bg-muted-foreground/45`,onSelect:g},e.id))]}),(0,K.jsx)(R,{page:s,pageSize:c,totalItems:e,onPageChange:_,compact:!0,itemLabel:`boards`})]})}function Qe({board:e,active:t,dotClassName:n,onSelect:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:F(`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:F(`h-1.5 w-1.5 rounded-full`,n)}),e.taskCount,` tasks`]}),(0,K.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]})}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){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 tt(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}:{}}}var nt={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function rt({title:e,value:t,inherited:n,onSave:r}){let{t:i}=m(),[a,o]=(0,B.useState)(t??nt),[s,c]=(0,B.useState)(at(t?.allow??[])),[l,u]=(0,B.useState)(at(t?.deny??[])),[d,f]=(0,B.useState)(null);return(0,B.useEffect)(()=>{o(t??nt),c(at(t?.allow??[])),u(at(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)(ne,{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)(it,{label:i(`activity:kanban.allowSelectors`),value:s,onChange:c}),(0,K.jsx)(it,{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=ot(s),t=ot(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)(he,{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 it({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 at(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
+
`)}function ot(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 st({audit:e,onSelectTask:t}){let[n,r]=(0,B.useState)(!0),i=(0,B.useId)(),a=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let t=new Set(e.issues.map(e=>e.id)),n=a.current;a.current=t,n!==null&&[...t].some(e=>!n.has(e))&&r(!0)},[e.issues]),e.issues.length===0)return null;let o=ct(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:F(`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:o.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:F(`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 ct(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()]}var lt=[`id`,`name`,`type`];function J(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 lt){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function ut(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var dt=new Set([`completed`,`review`,`failed`]);function ft(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(dt.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 pt(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));for(let t of e.tasks)n.has(t.id)||i.push(r(t,0));return i}function mt(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 ht(e,t){return e?.columns.find(e=>e.id===t)?.title??t}function gt({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 Y({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 _t({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 vt(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 yt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function bt(e){return e===`completed`||e===`failed`||e===`cancelled`}function xt(e,t){return t?Math.round(e/t*100):0}function St(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 _=xt(o.filter(e=>!!e.actor).length,o.length),v=xt(o.filter(e=>!!e.sessionId).length,o.length),y=xt(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={...yt([...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=>bt(String(yt(e.after).status??``))&&!!e.note?.trim()));return bt(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 Ct(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 wt({board:e,task:t,events:n}){let{t:r}=m(),i=St(e,t,n),a=z(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 ${Ct(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)(ge,{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)(R,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,compact:!0,itemLabel:r(`activity:taskRisk.itemLabel`)})]})]})]})}function Tt(e,t,n){let r=t.assignment,i=St(e,t,[]).findings.filter(e=>e.category===`operational`),a=J(r?.provider),o=J(r?.model);return{owner:J(r?.name)??J(r?.agentId)??J(r?.role)??J(t.assignee)??J(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:ut(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 Et(e){let t=e.tasks.map(e=>`${e.id}:${e.status}`).sort().join(`|`),n=(e.presence??[]).filter(e=>e.active).map(e=>e.taskId).sort().join(`|`);return`${e.id}|${t}|${n}`}function Dt(e){let t=e.assignment;return[e.id,e.status,e.dueDate??``,e.assignee??``,e.assignedAgent??``,JSON.stringify(e.dependsOn??null),JSON.stringify(e.childTaskIds??null),JSON.stringify((e.successCriteria??[]).map(e=>`${e.id}:${e.status}`)),e.atomicityAssessment?.verdict??``,e.verificationReport?.attachments.length??0,e.decomposition?.status??``,t?JSON.stringify({provider:t.provider,model:t.model,name:t.name,agentId:t.agentId,role:t.role,attempt:t.attempt,maxAttempts:t.maxAttempts,fallbackProfile:t.fallbackProfile,fallbackModels:t.fallbackModels,status:t.status,error:t.error,lastFailureKind:t.lastFailureKind,lastResult:t.lastResult,leaseExpiresAt:t.leaseExpiresAt,heartbeatAt:t.heartbeatAt,modelRouting:t.modelRouting}):``].join(`:`)}function Ot({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let{t:c}=m(),l=I(e=>e.verificationActivity),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(0),[p,h]=(0,B.useState)(null);(0,B.useEffect)(()=>{r===null&&(f.current=0,d(!1))},[r]),(0,B.useEffect)(()=>{if(p===null)return;let e=window.setTimeout(()=>h(null),4e3);return()=>window.clearTimeout(e)},[p]);let g=(0,B.useRef)(new Map),_=Et(e),v=Math.floor(Date.now()/6e4);(0,B.useEffect)(()=>{g.current.clear()},[_,v]);let y=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order),b=y.length===0,x=t=>{let n=g.current,r=`${_}|${v}|${Dt(t)}`,i=n.get(r);if(i){let a=l?.[`${e.id}:${t.id}`],o=ut(t,a);if(o===i.verification)return i;let s={...i,verification:o};return n.set(r,s),s}let a=Tt(e,t,l);return n.set(r,a),a};return(0,K.jsxs)(`section`,{className:F(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,u&&`border-primary/70 bg-primary/5`,b?`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:y.length})]}),(0,K.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragEnter:e=>{e.preventDefault(),f.current+=1,d(!0)},onDragLeave:()=>{f.current=Math.max(0,f.current-1),f.current===0&&d(!1)},onDragOver:e=>{e.preventDefault(),u||d(!0)},onDrop:n=>{if(n.preventDefault(),f.current=0,d(!1),e.lifecycle?.mode===`managed`){i(null);return}let a=n.dataTransfer.getData(`text/plain`)||r;a&&e.tasks.some(e=>e.id===a)&&s(a,t.id),i(null)},children:y.map(t=>{let r=x(t);return(0,K.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:n=>{e.lifecycle?.mode!==`managed`&&(i(t.id),n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,t.id))},onDragEnd:()=>i(null),className:F(`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:F(`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:p===t.id?c(`activity:kanban.confirmDeleteTask`):c(`activity:kanban.deleteTask`),"aria-label":p===t.id?c(`activity:kanban.confirmDeleteTaskAria`,{title:t.title}):c(`activity:kanban.deleteTaskAria`,{title:t.title}),onClick:()=>{p===t.id?(h(null),o(t)):h(t.id)},onBlur:()=>h(e=>e===t.id?null:e),className:F(`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors`,p===t.id?`bg-destructive/15 text-destructive ring-1 ring-destructive/40`:`text-muted-foreground hover:bg-destructive/10 hover:text-destructive`),children:(0,K.jsx)(se,{size:14})})]}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[e.lifecycle?.mode!==`managed`&&(0,K.jsx)(`select`,{"aria-label":c(`activity:kanban.moveTaskToColumn`,{title:t.title}),value:t.columnId,draggable:!1,onDragStart:e=>e.stopPropagation(),onChange:e=>{e.target.value!==t.columnId&&s(t.id,e.target.value)},className:`pointer-events-auto relative max-w-28 cursor-pointer rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-primary`,children:e.columns.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.title},e.id))}),(0,K.jsx)(`span`,{className:vt(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:F(`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 kt({board:e,sendKanban:n,onSelectTask:r}){let{t:i}=m(),[a,o]=(0,B.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)(E,{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)(D,{size:12}),` `,i(`activity:kanbanDecomp.reject`)]})]},a.id))})]}):null}var At=[`assessed`,`proposed`,`approval`,`applied`];function jt(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function Mt({board:e,task:n,sendKanban:r,onSelectTask:i}){let{t:a}=m(),o=n.decomposition,s=jt(n),c=(0,B.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)(E,{size:13}),a(`activity:kanbanDecomp.decomposition`)]}),(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 text-[11px]`,children:[At.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:F(`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)(D,{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]})]})]})}function Nt({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 Pt({runLink:e,sendRaw:t}){let{t:n}=m(),i=e.engine===`sdd`,a=i?`sdd.board`:`goal`,o=Se(e=>e.setCurrentView),s=(n,r={})=>t(n,e.runId?{runId:e.runId,...r}:r),c=`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)(A,{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:c,title:n(`activity:kanban.openLiveRun`),onClick:()=>o(`sddhub`),children:[(0,K.jsx)(A,{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:c,onClick:()=>s(`${a}.pause`),children:[(0,K.jsx)(ce,{size:12}),` `,n(`activity:kanban.actionPause`)]}),(0,K.jsxs)(`button`,{type:`button`,className:c,onClick:()=>s(`${a}.resume`),children:[(0,K.jsx)(M,{size:12}),` `,n(`activity:kanban.actionResume`)]}),i&&(0,K.jsxs)(`button`,{type:`button`,className:c,onClick:()=>s(`sdd.board.retry_all_failed`),children:[(0,K.jsx)(de,{size:12}),` `,n(`activity:kanban.actionRetryFailed`)]}),(0,K.jsxs)(`button`,{type:`button`,className:F(c,`text-destructive hover:bg-destructive/10`),onClick:()=>s(`${a}.stop`),children:[(0,K.jsx)(r,{size:12}),` `,n(`activity:kanban.actionStop`)]})]})]})}function Ft({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)(A,{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 It({runLink:e,runTaskId:n,modelCandidates:i,sendRaw:a}){let{t:o}=m(),s=e.engine===`sdd`,[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(t,n={})=>a(t,e.runId?{runId:e.runId,...n}:n),p=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,h=()=>{let e=u.trim();e&&(f(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)(L,{candidates:i,placeholder:o(`activity:kanban.setModelForTask`),onPick:(e,t)=>f(`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`&&h(),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:h,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)(D,{size:14})})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>f(s?`sdd.board.retry`:`goal.retryTask`,{taskId:n}),children:[(0,K.jsx)(de,{size:13}),` `,o(`common:action.retry`)]}),(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>l(!0),children:[(0,K.jsx)(v,{size:13}),` `,o(`activity:kanban.actionReassign`)]}),s?(0,K.jsxs)(`button`,{type:`button`,className:F(p,`text-destructive hover:bg-destructive/10`),onClick:()=>f(`sdd.board.cancel_task`,{taskId:n}),children:[(0,K.jsx)(r,{size:13}),` `,o(`common:action.cancel`)]}):(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>f(`goal.runTask`,{taskId:n}),children:[(0,K.jsx)(M,{size:13}),` `,o(`activity:kanban.actionRunNow`)]})]})]})}var Lt={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 Rt(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 zt({assignment:e}){let{t}=m(),n=e.status===`running`,r=Rt(e.dispatchedAt,e.completedAt),i=J(e.name)??J(e.agentId),a=J(e.role),o=J(e.provider),s=J(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:F(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,Lt[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 Bt({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 Vt({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 Ht=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Ut=[{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 Wt(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function Gt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Kt(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?X(Gt(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 qt(e){let t=Gt(e.before),n=Gt(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 Jt(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 Yt(e){let t=Gt(e.before),n=Gt(e.after);if(e.type.startsWith(`task.file.`)){let e=X(n.filePath),t=X(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[X(n.outcome),X(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=X(t.columnId),r=X(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=qt(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=X(t.stage),r=X(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=X(n.name)??X(n.agentId)??X(n.role),t=X(n.provider),r=X(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[X(n.description),X(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[X(n.name),X(n.status)].filter(Boolean).join(` · `)||void 0}function Xt(e){let t=e.type;return X(Gt(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 Zt(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 Qt(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 $t(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 en({event:e}){let t=Gt(e.after),n=X(t.provider),r=X(t.model),i=X(t.modelRouting),a=X(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=X(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 tn({task:e,events:n,sessionId:r,loading:i=!1,error:a,onRefresh:o}){let{t:s}=m(),[c,l]=(0,B.useState)(`all`),[u,d]=(0,B.useState)(``),[p,h]=(0,B.useState)(!1),g=(0,B.useMemo)(()=>$t(e,n,r),[e,n,r]),v=(0,B.useMemo)(()=>({all:g.length,execution:g.filter(e=>Kt(e)===`execution`).length,changes:g.filter(e=>Kt(e)===`changes`).length,notes:g.filter(e=>Kt(e)===`notes`).length,failures:g.filter(e=>Kt(e)===`failures`).length}),[g]),y=(0,B.useMemo)(()=>{let e=u.trim().toLowerCase();return g.filter(t=>c!==`all`&&Kt(t)!==c?!1:!e||[Jt(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=z(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(Wt(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(Wt(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)(k,{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)(j,{className:F(`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:F(`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)(re,{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)(D,{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=Yt(e),n=e.sessionId??r,i=qt(e),a=Kt(e)===`failures`,o=e.type.includes(`completed`)||X(Gt(e.after).outcome)===`succeeded`;return(0,K.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,K.jsx)(`span`,{className:F(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,Xt(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:Jt(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:Zt(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:F(`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:Qt(e.before)}),` `,(0,K.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,K.jsx)(`span`,{className:`text-foreground`,children:Qt(e.after)})]})]},e.field))}),(0,K.jsx)(en,{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)(R,{page:b.page,pageSize:b.pageSize,totalItems:b.totalItems,onPageChange:b.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function nn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function rn(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 an(e,t){return Z(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 on(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function sn(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 cn(e,t,n){let r=$t(e,t,n).filter(rn).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=nn(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=an(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=Z(t.name)??Z(t.agentId)??Z(t.role)??e.actor??u.owner,u.provider=Z(t.provider)??u.provider,u.model=Z(t.model)??u.model,u.routingMode=Z(t.modelRouting)??u.routingMode,u.fallbackProfile=Z(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??Z(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??Z(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=Z(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=Z(t.error)??e.note??u.error),on(l)&&(u.endedAt=e.ts),i.set(a,u),s=on(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:sn(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function ln(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 un(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 dn({task:e,events:t,sessionId:n}){let{t:r}=m(),i=cn(e,t,n),o=z(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] ${un(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 ${un(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`}),` `,ln(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)(le,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,K.jsx)(O,{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)(R,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function fn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Q(e){return J(e)}function pn(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 mn(e,t,n,r,i,a,o){let s=$t(t,n,r),c=pn(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=fn(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Q(u?.modelRouting)??Q(f.modelRouting)??`session`,m=Q(u?.provider)??Q(f.provider)??(p===`session`?Q(i):void 0),h=Q(u?.model)??Q(f.model)??(p===`session`?Q(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Q).filter(e=>e!==void 0),_=Q(u?.fallbackProfile)??Q(f.fallbackProfile),v=Q(u?.name)??Q(u?.agentId)??Q(u?.role)??Q(t.assignee)??Q(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(fn(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,ee=s.find(e=>Kt(e)===`failures`),w=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 ${hn(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??ee?.note,lastResult:u?.lastResult??w?.note,eventCount:s.length,lastActivity:s[0]}}function hn(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function gn(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 _n({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 vn({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 yn({board:e,task:t,events:n,presence:r,sessionId:i,sessionProvider:a,sessionModel:o}){let{t:s}=m(),c=mn(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),_=pn(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)(fe,{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)(_n,{icon:(0,K.jsx)(le,{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:Q(t.assignee)??Q(t.assignedAgent)??`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentId`),value:Q(l?.agentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentNameRole`),value:[Q(l?.name),Q(l?.role)].filter(Boolean).join(` · `)||`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.runStatus`),value:Q(l?.status)??`unassigned`}),(0,K.jsx)($,{label:s(`activity:taskIntel.subagent`),value:Q(l?.subagentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.runTask`),value:Q(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)(_n,{icon:(0,K.jsx)(O,{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(Q).filter(Boolean).join(`, `)||`Default`}),(0,K.jsx)($,{label:s(`activity:taskIntel.tools`),value:l?.tools?.map(Q).filter(Boolean).join(`, `)||`Default toolset`}),(0,K.jsx)($,{label:s(`activity:taskIntel.capabilities`),value:l?.allowedCapabilities?.map(Q).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,K.jsxs)(_n,{icon:(0,K.jsx)(ne,{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)(_n,{icon:(0,K.jsx)(f,{className:`size-3`}),title:s(`activity:taskIntel.timingAuditCoverage`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.created`),value:hn(t.createdAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.updated`),value:hn(t.updatedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.due`),value:hn(t.dueDate)}),(0,K.jsx)($,{label:s(`activity:taskIntel.dispatched`),value:hn(l?.dispatchedAt??l?.claimedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.completed`),value:hn(l?.completedAt??t.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.duration`),value:gn(l?.dispatchedAt??l?.claimedAt,l?.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.heartbeat`),value:hn(l?.heartbeatAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.leaseExpires`),value:hn(l?.leaseExpiresAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.actors`),value:c.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,K.jsxs)(_n,{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)(vn,{items:c.dependencies})}),(0,K.jsx)($,{label:s(`activity:taskIntel.otherRelations`),value:(0,K.jsx)(vn,{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 bn={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`}},xn={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 Sn(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 Cn({verdict:e}){let{t}=m(),n=bn[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 wn({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,B.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 Tn({check:e}){let t=xn[e.status],{t:n}=m(),[r,i]=(0,B.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)(pe,{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 En({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 Dn({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 On({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)(ee,{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 kn({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)(Cn,{verdict:e.verdict})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:Sn(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)(wn,{title:t(`activity:verifyReport.checkResults`),icon:T,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,K.jsx)(Tn,{check:e},e.checkId))}),e.fileScope&&(0,K.jsx)(wn,{title:t(`activity:verifyReport.fileScope`),icon:pe,defaultOpen:!e.fileScope.scopeMatches,children:(0,K.jsx)(En,{fileScope:e.fileScope})}),e.subtasks&&(0,K.jsx)(wn,{title:t(`activity:verifyReport.subTasks`),icon:T,children:(0,K.jsx)(Dn,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,K.jsx)(wn,{title:`Attachments (${e.attachments.length})`,icon:ee,children:(0,K.jsx)(On,{attachments:e.attachments})})]})}function An({boardId:e,task:t,sendKanban:n}){let{t:r}=m();return ut(t,I(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)(ae,{size:14,className:`animate-spin`}),r(`activity:taskVerify.verificationRunningChecksAreBeingExecuted`)]}):t.verificationReport?(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(kn,{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)(w,{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 jn({boards:e,board:t,task:r,runLink:i,onClose:a,onSelectTask:s,sendKanban:c,sendRaw:l,activityEvents:u,activityPresence:d,activityLoading:f,activityError:p,activitySessionId:g,refreshActivity:y}){let{t:b}=m(),[x,S]=(0,B.useState)(``),[C,ee]=(0,B.useState)(``),[w,re]=(0,B.useState)(``),[T,E]=(0,B.useState)(``),[O,k]=(0,B.useState)(``),[A,ae]=(0,B.useState)(`session`),[oe,se]=(0,B.useState)(``),[ce,le]=(0,B.useState)([]),[ue,de]=(0,B.useState)([]),[fe,pe]=(0,B.useState)([]),[me,ge]=(0,B.useState)([]),[j,M]=(0,B.useState)(``),N=Ce(!!r),P=Ge(!!r),_e=J(P.sessionProvider),ve=J(P.sessionModel),ye=we(`kanban-task-inspector`,!!r),[be,xe]=(0,B.useState)(!1),[I,Se]=(0,B.useState)(!1),[R,z]=(0,B.useState)(``),[Te,Ee]=(0,B.useState)(``),[De,Oe]=(0,B.useState)(``),[ke,Ae]=(0,B.useState)(`pending`),[V,je]=(0,B.useState)(``),[H,Me]=(0,B.useState)(``),[Ne,Pe]=(0,B.useState)(``),[Fe,Ie]=(0,B.useState)(`medium`),[Le,Re]=(0,B.useState)(`chore`),[U,ze]=(0,B.useState)(``),[W,Be]=(0,B.useState)([]),[Ve,He]=(0,B.useState)([]),[G,Ue]=(0,B.useState)(!1),[We,Ke]=(0,B.useState)(``),[qe,Je]=(0,B.useState)(``),[Ye,Xe]=(0,B.useState)(`off`),[Ze,Qe]=(0,B.useState)(``),[$e,et]=(0,B.useState)(``),[tt,nt]=(0,B.useState)(``),[it,at]=(0,B.useState)(``),[ot,st]=(0,B.useState)(``),[ct,lt]=(0,B.useState)(`observation`),[ut,dt]=(0,B.useState)(`unknown`),[ft,pt]=(0,B.useState)(``);(0,B.useEffect)(()=>{let n=J(r?.assignment?.provider),i=J(r?.assignment?.model);S(J(r?.assignment?.agentId)??J(r?.assignedAgent)??``),ee(J(r?.assignment?.name)??``),re(J(r?.assignment?.role)??``),E(n??``),k(i??``),ae(r?.assignment?.modelRouting??(n||i?`fixed`:`session`)),se(J(r?.assignment?.fallbackProfile)??``),le(r?.assignment?.fallbackModels??[]),de(r?.assignment?.skills??[]),pe(r?.assignment?.tools??[]),ge(r?.assignment?.allowedCapabilities??[]),M(e.find(e=>e.id!==t?.id)?.id??``),z(r?.title??``),Ee(r?.description??``),Oe(r?.dueDate??``),Ae(r?.status??`pending`),je(``),Me(``),Pe(``),Ie(r?.priority??`medium`),Re(r?.type??`chore`),ze(r?.labels?.join(`, `)??``),Be(r?.dependsOn??[]),He(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]:[]),Ue(!1),Ke(r?.estimatedHours?.toString()??``),Je(r?.actualHours?.toString()??``),Xe(r?.retryPolicy??r?.assignment?.retryPolicy??`off`),Qe((r?.costCeilingUsd??r?.assignment?.costCeilingUsd)?.toString()??``),et(r?.assignment?.maxAttempts?.toString()??``),nt(``),at(``),st(``),lt(`observation`),dt(`unknown`),pt(``)},[t?.id,r?.id]);let mt=e=>({boardId:t?.id,taskId:r?.id,...x.trim()?{agentId:x.trim()}:{},...C.trim()?{name:C.trim()}:{},...w.trim()?{role:w.trim()}:{},modelRouting:A,...A===`fixed`&&T.trim()?{provider:T.trim()}:{},...A===`fixed`&&O.trim()?{model:O.trim()}:{},...A===`fallback_profile`&&oe.trim()?{fallbackProfile:oe.trim()}:{},fallbackModels:ce,skills:ue,tools:fe,allowedCapabilities:me,...$e?{maxAttempts:Number($e)}:{},...Ze?{costCeilingUsd:Number(Ze)}:{},retryPolicy:Ye,activityNote:ft.trim()||`${b(`activity:kanban.activityNoteTemplate`,{action:b(e===`dispatch`?`activity:kanban.dispatched`:`activity:kanban.assigned`),target:C.trim()||x.trim()||w.trim()||b(`activity:kanban.configuredAgentRoute`)})}`}),vt=()=>{!t||!r||!R.trim()||(c(`kanban.task.update`,{boardId:t.id,taskId:r.id,title:R.trim(),description:Te,dueDate:De||null,...t.lifecycle?.mode===`managed`?{}:{status:ke},priority:Fe,type:Le,labels:U.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:W,...r.chain&&Ve.length<=1?{chain:null}:{},estimatedHours:We?Number(We):0,actualHours:qe?Number(qe):0,retryPolicy:Ye,costCeilingUsd:Ze?Number(Ze):null,activityNote:ft.trim()||`Task contract edited in WebUI.`}),Ve.length>1&&c(`kanban.task.chain`,{boardId:t.id,taskIds:Ve,enforceDependencies:G}),pt(``))},yt=[`backlog`,`todo`,`running`,`review`,`done`],bt=r?.lifecycle?.currentStage,xt=bt?yt.indexOf(bt):-1,St=xt>=0&&xt<yt.length-1?yt[xt+1]:void 0;return r?(0,K.jsxs)(`aside`,{"aria-label":b(`activity:kanban.taskInspector`),"data-expanded":I?`true`:`false`,className:F(`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`,I?`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:F(`flex h-12 items-center gap-2 border-b px-3`,I&&`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:b(`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:b(I?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-label":b(I?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-pressed":I,onClick:()=>Se(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:I?(0,K.jsx)(o,{size:16}):(0,K.jsx)(te,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:b(`common:action.close`),onClick:()=>{Se(!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)(D,{size:16})})]}),r?(0,K.jsxs)(`div`,{ref:ye,className:F(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,I&&`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)(rt,{title:b(`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.`})}}),(0,K.jsx)(Y,{label:b(`activity:kanban.title`),value:R,onChange:z}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:b(`activity:kanbanInspector.descriptionWorkingContext`)}),(0,K.jsx)(`textarea`,{value:Te,onChange:e=>Ee(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:b(`activity:kanban.managedStage`)}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:r.lifecycle?.currentStage??`Backlog`})]}):(0,K.jsx)(_t,{label:b(`activity:kanban.status`),value:ke,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>Ae(e)}),(0,K.jsx)(_t,{label:b(`activity:kanban.priority`),value:Fe,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Ie(e)}),(0,K.jsx)(_t,{label:b(`activity:kanban.type`),value:Le,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>Re(e)}),(0,K.jsx)(Y,{label:b(`activity:kanban.labelsCommaSeparated`),value:U,onChange:ze})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(Y,{label:b(`activity:kanban.dueDatePlaceholder`),value:De,onChange:Oe}),(0,K.jsx)(Y,{label:b(`activity:kanban.estimatedHours`),value:We,onChange:Ke}),(0,K.jsx)(Y,{label:b(`activity:kanban.actualHours`),value:qe,onChange:Je})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:b(`activity:kanbanInspector.dependencies`)}),(0,K.jsx)(q,{options:(t?.tasks??[]).filter(e=>e.id!==r.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:W,onChange:Be,placeholder:b(`activity:kanban.selectBlockingTasks`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:b(`activity:kanbanInspector.taskChainSelectionOrder`)}),(0,K.jsx)(q,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:Ve,onChange:e=>He(e.includes(r.id)?e:[r.id,...e]),placeholder:b(`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:G,onChange:e=>Ue(e.target.checked)}),b(`activity:kanban.enforceChainOrder`)]})]}),(0,K.jsx)(Y,{label:b(`activity:kanban.assignmentReason`),value:ft,onChange:pt}),(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)(he,{size:15}),` `,b(`activity:kanbanInspector.saveTaskContract`)]}),t?.lifecycle?.mode===`managed`&&St&&(0,K.jsxs)(`section`,{"aria-label":b(`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:b(`activity:kanban.kanbanAgentTransition`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[bt,` → `,St,`; no stages can be skipped.`]})]}),(0,K.jsx)(ne,{size:16,className:`text-primary`})]}),(0,K.jsx)(Y,{label:b(`activity:kanban.completedAction`),value:H,onChange:Me}),(0,K.jsx)(Y,{label:b(`activity:kanban.progressComment`),value:V,onChange:je}),(0,K.jsx)(Y,{label:b(`activity:kanban.evidenceUrl`),value:Ne,onChange:Pe}),(0,K.jsxs)(`button`,{type:`button`,disabled:!V.trim(),onClick:()=>{!t||!r||!St||!V.trim()||c(`kanban.task.transition`,{boardId:t.id,taskId:r.id,to:St,actor:x.trim()||C.trim()||r.assignee||r.assignedAgent||`webui-agent`,comment:V.trim(),...H.trim()?{action:H.trim()}:{},...Ne.trim()?{attachment:{url:Ne.trim(),type:`url`,title:`Evidence for ${r.title}`}}:{}})},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 `,St]})]})]}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(yn,{board:t,task:r,events:u,presence:d,sessionId:g,sessionProvider:_e,sessionModel:ve}),(0,K.jsx)(dn,{task:r,events:u,sessionId:g}),(0,K.jsx)(wt,{board:t,task:r,events:u})]}),(0,K.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,K.jsx)(gt,{label:b(`activity:kanban.source`),value:r.origin?.system??`manual`}),(0,K.jsx)(gt,{label:b(`activity:kanban.taskId`),value:r.id.slice(0,8)}),(0,K.jsx)(gt,{label:b(`activity:kanban.run`),value:r.assignment?.status??`unassigned`}),(0,K.jsx)(gt,{label:b(`activity:kanban.column`),value:ht(t,r.columnId)})]}),r.assignment&&(0,K.jsx)(zt,{assignment:r.assignment}),i&&r.origin?.taskId&&(0,K.jsx)(It,{runLink:i,runTaskId:r.origin.taskId,modelCandidates:N,sendRaw:l}),!i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.jsx)(_t,{label:b(`activity:kanban.primaryModelSource`),value:A,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>ae(e)}),A===`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`,`.`]}),A===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:b(`activity:kanbanInspector.fixedProviderModel`)}),(0,K.jsx)(L,{value:O||void 0,provider:T||void 0,candidates:N,placeholder:b(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{k(e),E(t)}})]}),A===`fallback_profile`&&(0,K.jsx)(_t,{label:b(`activity:kanban.fallbackProfile`),value:oe,options:Object.keys(P.fallbackProfiles),placeholder:b(`activity:kanban.selectProfile`),onChange:se}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:b(`activity:kanban.fallbackModels`)}),(0,K.jsx)(q,{options:N.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:ce,onChange:le,placeholder:b(`activity:kanban.addFallbackModel`),emptyLabel:`No models — add a provider in Settings`})]}),(0,K.jsx)(_t,{label:b(`activity:kanban.role`),value:w,options:Ht,placeholder:b(`activity:kanban.selectRole`),onChange:re}),(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:b(`activity:kanbanInspector.forceLoadedIntoTheWorker`)})]}),(0,K.jsx)(q,{options:P.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:ue,onChange:de,placeholder:b(`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:b(`activity:kanbanInspector.blankFullDefaultToolset`)})]}),(0,K.jsx)(q,{options:P.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:fe,onChange:pe,placeholder:b(`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:[b(`activity:kanbanInspector.advanced`),(0,K.jsx)(h,{size:13,className:F(`transition-transform`,be&&`rotate-180`)})]}),be&&(0,K.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,K.jsx)(Y,{label:b(`activity:kanban.agentNameOptional`),value:C,onChange:ee}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(_t,{label:b(`activity:kanban.retryPolicy`),value:Ye,options:[`off`,`incremental`,`exponential`],onChange:e=>Xe(e)}),(0,K.jsx)(Y,{label:b(`activity:kanban.maxAttempts`),value:$e,onChange:et}),(0,K.jsx)(Y,{label:b(`activity:kanban.costCeilingUsd`),value:Ze,onChange:Qe})]}),(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:b(`activity:kanbanInspector.blankSafeDefaults`)})]}),(0,K.jsx)(q,{options:Ut,selected:me,onChange:ge,placeholder:b(`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`,mt(`assign`)),pt(``))},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}),b(`activity:kanbanInspector.assign`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||(c(`kanban.task.dispatch`,mt(`dispatch`)),pt(``))},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)(ie,{size:15}),b(`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:b(`activity:kanban.targetBoard`)}),(0,K.jsx)(`select`,{value:j,onChange:e=>M(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||!j||c(`kanban.task.copy`,{boardId:t.id,taskId:r.id,targetBoardId:j})},disabled:!j,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}),b(`activity:kanbanInspector.copy`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||!j||c(`kanban.task.transfer`,{boardId:t.id,taskId:r.id,targetBoardId:j})},disabled:!j,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}),b(`activity:kanbanInspector.transfer`)]})]})]}):null,(0,K.jsx)(Vt,{board:t,task:r,newCheck:tt,onNewCheckChange:nt,onAddCheck:()=>{!t||!r||!tt.trim()||(c(`kanban.task.check.add`,{boardId:t.id,taskId:r.id,description:tt.trim(),checkType:`manual`}),nt(``))},sendKanban:c}),t&&(0,K.jsx)(An,{boardId:t.id,task:r,sendKanban:c}),t&&(0,K.jsx)(Mt,{board:t,task:r,sendKanban:c,onSelectTask:s}),(0,K.jsx)(tn,{task:r,events:u,sessionId:g,loading:f,error:p,onRefresh:y}),(0,K.jsx)(Bt,{activityKind:ct,activityOutcome:ut,note:it,details:ot,onActivityKindChange:lt,onActivityOutcomeChange:dt,onNoteChange:at,onDetailsChange:st,onRecordActivity:()=>{!t||!r||!it.trim()||(c(`kanban.task.activity.add`,{boardId:t.id,taskId:r.id,kind:ct,outcome:ut,summary:it.trim(),...ot.trim()?{details:ot.trim()}:{},actor:C.trim()||x.trim()||`webui-operator`}),at(``),st(``),window.setTimeout(y,150))}})]}):null]}):null}var Mn={unverified:{labelKey:`activity:kanbanTree.verifyUnverified`,className:`bg-muted text-muted-foreground`,icon:w},running:{labelKey:`activity:kanbanTree.verifyVerifying`,className:`bg-info/10 text-info`,icon:ae},passed:{labelKey:`activity:kanbanTree.verifyVerified`,className:`bg-success/10 text-success`,icon:ne},failed:{labelKey:`activity:kanbanTree.verifyFailed`,className:`bg-destructive/10 text-destructive`,icon:me},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 Nn({task:e}){return e.status===`completed`?(0,K.jsx)(t,{size:13,className:`text-success`}):e.status===`failed`?(0,K.jsx)(D,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,K.jsx)(ae,{size:13,className:`animate-spin text-info`}):(0,K.jsx)(b,{size:13,className:`text-muted-foreground`})}function Pn({board:e,selectedTaskId:t,onSelectTask:n}){let{t:r}=m(),i=I(e=>e.verificationActivity),a=(0,B.useMemo)(()=>mt(pt(e)),[e.id,e.revision]);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=ut(a,i[`${e.id}:${a.id}`]),l=Mn[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:F(`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)(Nn,{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:F(`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:F(`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 Fn({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:F(`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 In({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:F(`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 Ln({board:e,onSelectTask:t}){let{t:n}=m(),r=(0,B.useMemo)(()=>ft(e),[e.id,e.revision]);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)(Fn,{label:`verified`,value:r.passed,tone:`success`}),(0,K.jsx)(Fn,{label:`failed`,value:r.failed,tone:`destructive`}),(0,K.jsx)(Fn,{label:n(`activity:verifyReport.verdictNeedsHuman`),value:r.needsHuman,tone:`warning`}),(0,K.jsx)(Fn,{label:`incomplete`,value:r.incomplete,tone:`warning`}),(0,K.jsx)(Fn,{label:`unverified`,value:r.unverified,tone:`muted`})]}),(0,K.jsx)(In,{title:n(`activity:kanban.failingChecks`),icon:me,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)(In,{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)(In,{title:n(`activity:kanban.needsDecomposition`),icon:E,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)(In,{title:n(`activity:kanban.decompositionPending`),icon:w,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)(ne,{size:14}),n(`activity:kanban.noOutstanding`)]})]})}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:F(`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,B.useState)([]);return(0,B.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=ye(e=>e.wsUrl),r=ve(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,setActiveBoardId:v,setError:b}=I(),[x,S]=(0,B.useState)(``),[C,ee]=(0,B.useState)(1),w=Bn(),[te,ne]=(0,B.useState)(``),re=(0,B.useRef)(null);De(re);let[T,E]=(0,B.useState)(``),[O,k]=(0,B.useState)(null),[A,ie]=(0,B.useState)([]),[ae,oe]=(0,B.useState)(),[ce,le]=(0,B.useState)(!1),[ue,de]=(0,B.useState)(null),[fe,pe]=(0,B.useState)(0),[me,he]=(0,B.useState)(null),[ge,j]=(0,B.useState)(`board`),[M,N]=(0,B.useState)(!1),P=(0,B.useRef)(null),Se=(0,B.useRef)(null),Ce=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if(!M)return;let e=window.setTimeout(()=>{N(!1),P.current=null},4e3);return()=>window.clearTimeout(e)},[M]),(0,B.useEffect)(()=>{N(!1),P.current=null},[u]);let L=(0,B.useMemo)(()=>_e(n),[n]),R=d?.tasks.find(e=>e.id===O)??null,we=(0,B.useRef)([]),z=(0,B.useMemo)(()=>{let e=$e({sessionId:r,registrySessionIds:w,agents:a.values()}),t=we.current;return t.length===e.length&&t.every((t,n)=>t===e[n])?t:(we.current=e,e)},[a,w,r]),Te=o.filter(e=>xe(e,z)),Ee=o.filter(e=>!xe(e,z)),Oe=(0,B.useMemo)(()=>d?Ae(d,{now:Date.now(),requireDueDate:d.lifecycle?.mode===`managed`}):null,[d]),ke=(0,B.useMemo)(()=>et(d),[d]),V=(e,t={})=>{I.getState().sendKanban(e,t),L.send({type:e,payload:t})},je=(e,t={})=>{L.send({type:e,payload:t})},H=(0,B.useMemo)(()=>tt(d),[d]),Me=(e=C)=>V(`kanban.list`,{page:e,pageSize:Hn,activeSessionIds:z});(0,B.useEffect)(()=>{Me()},[]),(0,B.useEffect)(()=>{if(Ce.current)return;let e=r?o.find(e=>e.tags?.includes(`session:${r}`)):void 0,t=!!(r&&e)&&Se.current!==r,n=t?e:u?void 0:o[0];n?.id&&(t&&(Se.current=r),v(n.id),V(`kanban.get`,{boardId:n.id}))},[o,u,r,v]),(0,B.useEffect)(()=>{d&&O&&!d.tasks.some(e=>e.id===O)&&k(null)},[d,O]),(0,B.useEffect)(()=>{u&&(V(`kanban.health`,{boardId:u}),V(`kanban.supervisor.status`,{boardId:u}))},[u]),(0,B.useEffect)(()=>{if(!u)return;let e=setInterval(()=>{L.send({type:`kanban.get`,payload:{boardId:u}}),L.send({type:`kanban.health`,payload:{boardId:u}})},5e3);return()=>clearInterval(e)},[u,L]),(0,B.useEffect)(()=>{let e=setInterval(()=>{L.send({type:`kanban.list`,payload:{page:C,pageSize:Hn,activeSessionIds:z}})},8e3);return()=>clearInterval(e)},[z,C,L]);let Ne=e=>{ee(e),v(null),Ce.current=!0,Me(e)};(0,B.useEffect)(()=>{oe(void 0)},[u,O]),(0,B.useEffect)(()=>{if(!u||!O)return;let e=u,t=O;le(!0),de(null);let n=L.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){de(r.error??`Task activity could not be loaded.`),le(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(ie(r.data.events??[]),oe(r.data.presence??[]),le(!1))});return L.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Vn}}),n},[u,O,R?.updatedAt,fe,L]),(0,B.useEffect)(()=>{if(!(!u||!O))return L.on.bind(L)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===u&&t.taskId===O&&pe(e=>e+1)})},[u,O,L]);let Pe=()=>{let e=x.trim();e&&(S(``),V(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Fe=()=>{if(!d)return;let e=te.trim();e&&(ne(``),V(`kanban.task.add`,{boardId:d.id,title:e,columnId:d.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}))},Ie=()=>{if(!d)return;let e=T.trim();e&&(E(``),V(`kanban.column.add`,{boardId:d.id,title:e}))},Le=()=>{d&&V(`kanban.delete`,{boardId:d.id})},Re=()=>{d&&V(`kanban.duplicate`,{boardId:d.id,title:`${d.title} Copy`})},U=e=>{d&&V(`kanban.task.remove`,{boardId:d.id,taskId:e.id})},ze=(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;V(`kanban.task.move`,{boardId:d.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`})};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)(Ze,{boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoards:Te,orphanedBoards:Ee,boardPage:C,boardPageSize:Hn,loading:f,newBoardTitle:x,onClose:e,onRefresh:()=>Me(),onNewBoardTitleChange:S,onCreateBoard:Pe,onBoardSelect:e=>{Ce.current=!1,v(e),V(`kanban.get`,{boardId:e})},onBoardPageChange:Ne}),(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)(`h1`,{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:te,onChange:e=>ne(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Fe()},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:Fe,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:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()},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:Ie,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)(y,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.duplicateBoard`),onClick:Re,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`,"aria-pressed":M,title:t(M?`activity:kanban.confirmDeleteBoard`:`activity:kanban.deleteBoard`),onClick:()=>{M&&P.current===d?.id?(N(!1),P.current=null,Le()):(P.current=d?.id??null,N(!0))},className:F(`hidden h-8 items-center justify-center rounded-md border transition-colors sm:flex`,M?`w-16 gap-1 border-destructive/40 bg-destructive/15 text-[11px] font-semibold text-destructive`:`w-16 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`),children:M?t(`activity:kanban.confirmDelete`):(0,K.jsx)(se,{size:16})})]})]}),d&&(0,K.jsx)(Je,{presence:d.presence}),d&&(0,K.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,K.jsx)(rt,{title:t(`activity:kanban.boardBoundary`),value:d.boundary,onSave:e=>{V(`kanban.update`,{boardId:d.id,boundary:e})}})}),d&&H&&(0,K.jsx)(Pt,{runLink:H,sendRaw:je}),d&&!H&&d.tasks.length>0&&(0,K.jsx)(Ft,{boardId:d.id,sendKanban:V}),d&&(0,K.jsx)(Ye,{board:d,snapshot:g,sendKanban:V}),Oe&&(0,K.jsx)(st,{audit:Oe,onSelectTask:k}),d&&(0,K.jsx)(kt,{board:d,sendKanban:V,onSelectTask:k}),d&&(0,K.jsx)(zn,{viewMode:ge,onViewModeChange:j}),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)(D,{size:15}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`common:action.close`),onClick:()=>b(null),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded hover:bg-destructive/20`,children:(0,K.jsx)(D,{size:15})})]}),(0,K.jsx)(`div`,{ref:re,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)(Nt,{queueHealth:h,runningCostTotal:ke}),ge===`tree`?(0,K.jsx)(Pn,{board:d,selectedTaskId:O,onSelectTask:k}):ge===`dashboard`?(0,K.jsx)(Ln,{board:d,onSelectTask:k}):(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)(Ot,{board:d,column:e,selectedTaskId:O,dragTaskId:me,setDragTaskId:he,onSelectTask:k,onDeleteTask:U,onMoveTask:ze},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)(jn,{boards:o,board:d,task:R,runLink:H,onClose:()=>k(null),onSelectTask:k,sendKanban:V,sendRaw:je,activityEvents:A,activityPresence:ae,activityLoading:ce,activityError:ue,activitySessionId:d?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>pe(e=>e+1)},R?.id??`none`)]})}export{Un as KanbanView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ar as n,Fi as r,Ft as i,La as a,Pa as o,Qn as s,Wi as c,Xr as l,_n as u,an as d,dt as f,in as p,lt as m,nr as h,pa as g,pn as _,qn as v,xa as y,xt as b,za as x,zi as S}from"./vendor-BuarzSSb.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ar as n,Fi as r,Ft as i,La as a,Pa as o,Qn as s,Wi as c,Xr as l,_n as u,an as d,dt as f,in as p,lt as m,nr as h,pa as g,pn as _,qn as v,xa as y,xt as b,za as x,zi as S}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as C}from"./utils-B-9lSDIn.js";import{t as w}from"./mailbox-store-C1mzoSqJ.js";import{n as T}from"./ui-store-CE4-TlwB.js";import{o as E}from"./view-navigation-DIDEcp4V.js";import{g as D,u as O}from"./index-FHt-sKVF.js";import{t as k}from"./empty-state-RRSqQaCk.js";var A=e(x(),1),j=m(),M={note:l,ask:S,assign:p,steer:_,btw:g,broadcast:p,status:r,result:c,review:d},N={high:`border-destructive/25 bg-destructive/10 text-destructive`,normal:`border-border bg-muted text-muted-foreground`,low:`border-primary/20 bg-primary/10 text-primary`};function P(e){return new Date(e).toLocaleString()}function F(e){let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?a.t(`common:time.justNow`):n<36e5?a.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?a.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?a.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t}=o(),n=Object.entries(e);return n.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-success/10 text-success`,title:P(t),children:[(0,j.jsx)(c,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:r}=o(),a=T(e=>e.selectedMailMessage),l=T(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{l(null)},[l]);function d(){l(null),E(`chat`)}if(!a)return(0,j.jsx)(k,{icon:(0,j.jsx)(s,{className:`h-6 w-6`}),title:r(`activity:mailbox.emptyDetail`),description:r(`activity:mailbox.emptyDetailHint`)});let p=M[a.type]??v,m=r(`activity:mailbox.type.${a.type}`,{defaultValue:a.type}),g=N[a.priority]??N.normal,_=a.scope?{scope:a.scope,recipientSessionId:a.recipientSessionId}:w(a.to),x=a.to===`*`||a.to===`all`?r(`activity:mailbox.everyone`):a.to,S=_.scope===`session`?r(`activity:mailbox.sessionScope`,{sid:_.recipientSessionId??``}):_.scope===`project`?r(`activity:mailbox.projectScope`):r(`activity:mailbox.directScope`);return(0,j.jsx)(`div`,{className:C(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/70 px-3 py-3 sm:px-4 shrink-0`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:d,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.backToChat`),children:(0,j.jsx)(y,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className:C(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,a.completed?`bg-success/10`:`bg-primary/10`),children:(0,j.jsx)(p,{className:C(`h-4 w-4`,a.completed?`text-success`:`text-primary`)})}),(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)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:a.subject}),a.completed&&(0,j.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-md border border-success/25 bg-success/8 px-1.5 py-0.5 text-[10px] font-semibold text-success`,children:[(0,j.jsx)(c,{className:`h-3 w-3`}),r(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:C(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:a.priority||`normal`}),a.audience===`leaders`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-primary/25 bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[(0,j.jsx)(h,{className:`h-2.5 w-2.5`}),` `,r(`activity:mailbox.audienceLeaders`)]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground/80`,children:a.from}),(0,j.jsx)(`span`,{children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:x}),_.scope===`session`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-warning/12 text-warning`,title:r(`activity:mailbox.sessionScopeTitle`,{sid:_.recipientSessionId??``}),children:[(0,j.jsx)(h,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.sessionLabel`)]}),_.scope===`project`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-primary/12 text-primary`,children:[(0,j.jsx)(n,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.projectLabel`)]}),(0,j.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(t,{className:`h-3 w-3`}),F(a.timestamp)]})]})]}),(0,j.jsx)(`button`,{type:`button`,onClick:d,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.closeTitle`),children:(0,j.jsx)(f,{className:`h-4 w-4`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,j.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-5`,children:(0,j.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,j.jsx)(O,{components:D,children:a.body})})})}),(0,j.jsxs)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-3 shrink-0`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(i,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:m})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:C(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:a.priority||`normal`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(b,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,title:a.from,children:a.from})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[_.scope===`session`?(0,j.jsx)(h,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(n,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:r(`activity:mailbox.scopeLabel`)}),(0,j.jsx)(`span`,{className:`truncate`,children:S})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(t,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:P(a.timestamp)})]}),a.replyTo&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:r(`activity:mailbox.replyTo`,{id:a.replyTo})})]}),a.completed&&a.completedBy&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(c,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:a.completedAt?r(`activity:mailbox.completedByAt`,{name:a.completedBy,time:P(a.completedAt)}):r(`activity:mailbox.completedBy`,{name:a.completedBy})})]}),a.outcome&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.outcome`)}),(0,j.jsx)(`span`,{children:a.outcome})]}),a.taskContext&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.task`)}),(0,j.jsx)(`span`,{children:a.taskContext})]})]}),Object.keys(a.readBy??{}).length>0&&(0,j.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,j.jsx)(I,{readBy:a.readBy})})]})]})})}export{L as MailboxDetailView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ii as n,Ot as r,Pa as i,Tn as a,Wt as o,Xr as s,dt as c,ir as l,jr as u,li as d,lt as f,ui as p,vn as m,za as h}from"./vendor-BuarzSSb.js";import"./i18n-9T7iGYgW.js";import{t as g}from"./ws-client-TTMa0XaT.js";import{t as _}from"./utils-B-9lSDIn.js";import{t as v}from"./button-Dcy288Mc.js";import{b as y,x as b}from"./index-FHt-sKVF.js";import{g as x,h as S,l as C,r as w,v as T}from"./shared-KAzksK0C.js";var E=e(h(),1),D={filePath:``,primaryMatches:[],symbolMatches:[],relatedMatches:[],totalCount:0,activeCount:0,supersededCount:0,reviewPendingCount:0};function O(e){let{filePath:t,lineStart:n,lineEnd:r,limit:i=50,showSuperseded:a=!0,showDeleted:o=!1,autoFetch:s=!0,sendOptions:c}=e,l=c?JSON.stringify(c):``,[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(null),_=(0,E.useRef)(0),v=(0,E.useRef)(null),y=(0,E.useRef)(c);y.current=c;let b=(0,E.useCallback)(()=>{if(!t){d(null),h(null),p(!1);return}let e=++_.current;p(!0),h(null);let s=g();if(!s){h(`WebSocket client unavailable`),p(!1);return}v.current?.(),v.current=null;let c=t,l=s.on(`memory.sage.forFile`,t=>{if(e!==_.current)return;let n=t.payload.response;n&&n.filePath!==c||(t.payload.error?(h(t.payload.error),d(null)):(d(n??D),h(null)),p(!1))});v.current=l;let u={filePath:t,limit:i,showSuperseded:a,showDeleted:o,...n===void 0?{}:{lineStart:n},...r===void 0?{}:{lineEnd:r}};try{s.findMemoriesForFile(u,y.current??void 0)}catch(t){l(),v.current===l&&(v.current=null),e===_.current&&(h(t instanceof Error?t.message:String(t)),p(!1))}},[t,n,r,i,a,o]);(0,E.useEffect)(()=>{if(s)return b(),()=>{_.current++,v.current?.(),v.current=null}},[s,b,l]);let x=(0,E.useCallback)(()=>{b()},[b]);return(0,E.useEffect)(()=>()=>{v.current?.(),v.current=null},[]),{data:u,loading:f,error:m,refetch:x}}var k=f();function A(e){return e>=.9?`bg-success/15 border-success/40`:e>=.7?`bg-info/15 border-info/40`:e>=.4?`bg-warning/10 border-warning/30`:`bg-muted/30 border-border/40`}function j(e){switch(e){case`scope_file`:return`scope: file`;case`scope_symbol`:return`scope: symbol`;case`anchor_file`:return`anchor: file`;case`anchor_symbol`:return`anchor: symbol`;case`anchor_directory`:return`anchor: directory`;case`mention`:return`text mention`}}function M({match:e,cursorBoosted:n,onShowMemory:s,onAcceptDeletion:f,onKeep:p,onUpdate:h,onMarkPermanent:g,onRecover:y,pendingAction:b}){let{t:E}=i(),D=e.memory.status===`deleted`,O=e.memory.status===`superseded`,M=e.pendingReview,N=b!==void 0,P=n===!0;return(0,k.jsxs)(`article`,{className:_(`group relative rounded-md border px-3 py-2 text-sm transition-colors`,A(e.matchStrength),P&&`ring-1 ring-primary/40 ring-offset-0`,D&&`opacity-70`),"data-match-via":e.matchedVia,"data-memory-id":e.memory.id,children:[(0,k.jsx)(`header`,{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 text-[10px] uppercase tracking-wide`,children:[(0,k.jsx)(`span`,{className:_(`font-mono`,S(e.memory.kind)),children:w[e.memory.kind]??e.memory.kind}),(0,k.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,k.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:j(e.matchedVia)}),P&&(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-primary/15 px-1 py-0.5 font-mono text-primary`,title:E(`activity:memoryManager.anchorCursorHint`),children:[(0,k.jsx)(a,{className:`size-2.5`}),` `,E(`activity:memoryManager.cursorLabel`)]}),M&&(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-warning/15 px-1 py-0.5 font-mono text-warning`,title:E(`activity:memoryManager.hygieneReviewTitle`,{reason:M.reason,days:M.ageDays}),children:[(0,k.jsx)(r,{className:`size-2.5`}),` `,E(`activity:memoryManager.reviewLabel`)]}),D&&(0,k.jsx)(`span`,{className:`font-mono text-destructive`,children:E(`activity:memoryManager.statusDeleted`)}),O&&!D&&(0,k.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:E(`activity:memoryManager.statusSuperseded`)})]}),(0,k.jsx)(`p`,{className:`mt-1 text-foreground/90`,children:x(e.memory.text,200)}),(0,k.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,k.jsx)(C,{status:e.memory.status}),(0,k.jsx)(`span`,{children:E(`activity:memoryManager.updatedSuffix`,{date:T(e.memory.updatedAt)})})]})]})}),(0,k.jsxs)(`footer`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[D&&y&&(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>y(e.memory.id),className:`h-7 gap-1 border-primary/40 px-2 text-[11px] text-primary hover:bg-primary/10`,title:E(`activity:memoryManager.restoreTitle`),children:[(0,k.jsx)(m,{className:`size-3`}),` `,E(`activity:memoryManager.actionRecover`)]}),O&&e.supersededByActiveId&&s&&(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>s(e.supersededByActiveId),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.supersededJumpTitle`),children:[(0,k.jsx)(u,{className:`size-3`}),` `,E(`activity:memoryManager.actionGoToActive`)]}),M&&(f||p||h||g)&&(0,k.jsxs)(k.Fragment,{children:[M.suggestedAction===`delete`&&(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`destructive`,disabled:N,onClick:()=>f?.(M.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.acceptSuggestionTitle`),children:[(0,k.jsx)(t,{className:`size-3`}),` `,E(`activity:memoryManager.actionAcceptDeletion`)]}),(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>p?.(M.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.rejectSuggestionTitle`),children:[(0,k.jsx)(c,{className:`size-3`}),` `,E(`activity:memoryManager.actionKeep`)]}),(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>h?.(e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.updateTitle`),children:[(0,k.jsx)(o,{className:`size-3`}),` `,E(`activity:memoryManager.actionUpdate`)]}),g&&(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>g(e.memory.id),className:`h-7 gap-1 border-warning/40 px-2 text-[11px] text-warning hover:bg-warning/10`,title:E(`activity:memoryManager.promoteTitle`),children:[(0,k.jsx)(a,{className:`size-3`}),` `,E(`activity:memoryManager.actionMarkPermanent`)]})]}),s&&!D&&(0,k.jsxs)(v,{type:`button`,size:`sm`,variant:`ghost`,disabled:N,onClick:()=>s(e.memory.id),className:`h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,title:E(`activity:memoryManager.openRecordTitle`),children:[(0,k.jsx)(d,{className:`size-3`}),` `,E(`activity:memoryManager.actionShowFull`)]}),b&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,k.jsx)(l,{className:`size-3 animate-spin`}),` `,b]})]})]})}function N({icon:e,title:t,count:n,matches:r,cursorBoosted:o=!1,...s}){let{t:c}=i(),l=b(r,10);return r.length===0?null:(0,k.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsxs)(`h3`,{className:`flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,k.jsx)(e,{className:`size-3`}),(0,k.jsx)(`span`,{children:t}),(0,k.jsxs)(`span`,{className:`font-mono`,children:[`(`,n,`)`]}),o&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 font-mono text-[9px] text-primary`,children:[(0,k.jsx)(a,{className:`size-2.5`}),` `,c(`activity:memoryManager.cursorBoostTitle`)]})]}),(0,k.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:l.pageItems.map(e=>(0,k.jsx)(M,{match:e,cursorBoosted:o&&(e.matchedVia===`anchor_symbol`||e.matchedVia===`scope_symbol`),pendingAction:s.pendingActionById.get(e.memory.id),...s},e.memory.id))}),(0,k.jsx)(y,{page:l.page,pageSize:l.pageSize,totalItems:l.totalItems,onPageChange:l.setPage,compact:!0,itemLabel:c(`activity:memoryManager.itemLabel`)})]})}function P({filePath:e,lineStart:t,lineEnd:o,open:c,onClose:l,onShowMemory:u,onAcceptDeletion:f,onKeep:h,onUpdate:g,onMarkPermanent:y,onRecover:b}){let{t:x}=i(),[S,C]=(0,E.useState)(!1),[w,T]=(0,E.useState)(new Map),D={accepting:x(`activity:memoryManager.pendingAccepting`),keeping:x(`activity:memoryManager.pendingKeeping`),updating:x(`activity:memoryManager.pendingUpdating`),marking:x(`activity:memoryManager.pendingMarking`),recovering:x(`activity:memoryManager.pendingRecovering`)},{data:A,loading:j,error:M,refetch:P}=O({filePath:e,lineStart:t,lineEnd:o,showDeleted:S,autoFetch:c}),I=t!==void 0&&o!==void 0,L=(0,E.useCallback)(async(e,t,n)=>{if(n){T(n=>new Map(n).set(e,t));try{await n(e)}finally{T(t=>{let n=new Map(t);return n.delete(e),n})}}},[]);if((0,E.useEffect)(()=>{C(!1)},[e]),!c)return null;let R=A,z=R?.totalCount??0;return(0,k.jsxs)(`aside`,{className:`flex h-full min-h-0 w-full flex-col border-l border-border/70 bg-card/15`,"aria-label":x(`activity:memoryManager.fileDrawerAria`),"data-file-path":e??``,children:[(0,k.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-2`,children:[(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,k.jsx)(s,{className:`size-3`}),(0,k.jsx)(`span`,{className:`truncate font-mono`,title:e??``,children:e??x(`activity:memoryManager.noFile`)})]}),(0,k.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,k.jsx)(`span`,{className:`font-mono`,children:x(`activity:memoryManager.memoriesCount`,{count:z})}),R&&R.reviewPendingCount>0&&(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 font-mono text-warning`,children:[(0,k.jsx)(r,{className:`size-3`}),x(`activity:memoryManager.pendingReviewCount`,{count:R.reviewPendingCount})]}),R&&R.supersededCount>0&&(0,k.jsx)(`span`,{className:`font-mono`,children:x(`activity:memoryManager.supersededCount`,{count:R.supersededCount})})]})]}),(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,k.jsx)(v,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>P(),disabled:j||!e,className:`h-7 w-7 p-0`,"aria-label":x(`common:action.refresh`),title:x(`activity:memoryManager.requeryTitle`),children:(0,k.jsx)(m,{className:_(`size-3.5`,j&&`animate-spin`)})}),(0,k.jsx)(v,{type:`button`,size:`sm`,variant:`ghost`,onClick:l,className:`h-7 w-7 p-0`,"aria-label":x(`activity:memoryManager.closeDrawerAria`),title:x(`activity:memoryManager.closeDrawerTitle`),children:(0,k.jsx)(n,{className:`size-3.5`})})]})]}),(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 bg-background/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`size-3 accent-primary`,disabled:!e,"data-testid":`memory-drawer-show-deleted`}),S?(0,k.jsx)(d,{className:`size-3`}):(0,k.jsx)(p,{className:`size-3`}),(0,k.jsx)(`span`,{children:x(`activity:memoryManager.showRecoverable`)})]}),I&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[10px] text-primary`,children:[(0,k.jsx)(a,{className:`size-3`}),` `,x(`activity:memoryManager.linesRange`,{start:t,end:o})]})]}),(0,k.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-3 py-3`,children:e?j&&!R?(0,k.jsx)(F,{loading:!0,message:x(`activity:memoryManager.loadingMemories`)}):M?(0,k.jsx)(F,{tone:`error`,message:x(`activity:memoryManager.errorPrefix`,{message:M})}):!R||z===0?(0,k.jsx)(F,{message:x(`activity:memoryManager.emptyNoMemories`,{file:e})}):(0,k.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,k.jsx)(N,{icon:a,title:x(`activity:memoryManager.cursorBoostTitle`),count:R.symbolMatches.length,cursorBoosted:I,matches:R.symbolMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>f?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>h?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))}),(0,k.jsx)(N,{icon:s,title:x(`activity:memoryManager.fileScopedTitle`),count:R.primaryMatches.length,matches:R.primaryMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>f?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>h?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))}),(0,k.jsx)(N,{icon:d,title:x(`activity:memoryManager.mentionedInTitle`),count:R.relatedMatches.length,matches:R.relatedMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>f?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>h?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))})]}):(0,k.jsx)(F,{message:x(`activity:memoryManager.emptyOpenFile`)})})]})}function F({message:e,loading:t=!1,tone:n=`default`}){return(0,k.jsxs)(`div`,{className:_(`flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border/60 px-4 py-6 text-center text-[11px]`,n===`error`?`text-destructive`:`text-muted-foreground`),children:[t&&(0,k.jsx)(l,{className:`size-4 animate-spin`}),(0,k.jsx)(`p`,{children:e})]})}export{P as t};
|