@wrongstack/webui 0.298.1 → 0.298.3
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-C26RCdot.js → AgentRosterView-RvxaV08Y.js} +4 -4
- package/dist/assets/{AnalyticsDashboard-CEjjV3bX.js → AnalyticsDashboard-irejsLMt.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-CnfZC8x0.js → AudienceMemoryPanel-DDW_WPjf.js} +2 -2
- package/dist/assets/{ChangesView-D0BiTbs8.js → ChangesView-Bnd167hf.js} +1 -1
- package/dist/assets/{ChronicleDashboard-BZ4XOcvf.js → ChronicleDashboard-DC62FDEt.js} +1 -1
- package/dist/assets/CodeEditor-DCWcCQPO.js +1 -0
- package/dist/assets/CodeMap-DSqqgBuD.js +1 -0
- package/dist/assets/{CronJobsPanel-F6nhZtfg.js → CronJobsPanel-BXujnpGC.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-C9sLNUUc.js → DeadCodeScanPanel-HTbGUTMl.js} +1 -1
- package/dist/assets/{DebugDashboard-D8BLcLjI.js → DebugDashboard-B5kJBUv0.js} +1 -1
- package/dist/assets/{DesignGalleryView-B8mE5nGy.js → DesignGalleryView-BQ0CZpQm.js} +1 -1
- package/dist/assets/GoalView-DvaSR6CO.js +1 -0
- package/dist/assets/KanbanView-DpWs_i8T.js +3 -0
- package/dist/assets/MailboxDetailView-Dh8ekyMw.js +1 -0
- package/dist/assets/MemoryManager-CUAbNwsz.js +1 -0
- package/dist/assets/{ModelPicker-CNHhT2SO.js → ModelPicker-BxYMTEEN.js} +1 -1
- package/dist/assets/OfficeMapPanel-HgERknuN.js +4 -0
- package/dist/assets/{ProcessMonitor-Cc8LsfTh.js → ProcessMonitor-DVUCtVHZ.js} +1 -1
- package/dist/assets/{QueuePanel-B0NXFwEt.js → QueuePanel-n9lScdWu.js} +1 -1
- package/dist/assets/{RefreshDebugView-DLst_piS.js → RefreshDebugView-eZQ3wdxU.js} +1 -1
- package/dist/assets/{SageTabs-NwMcr4Pq.js → SageTabs-B-eQ--Sb.js} +2 -2
- package/dist/assets/SddHub-D81poT6w.js +2 -0
- package/dist/assets/{SessionsDashboard-C5dXb0iJ.js → SessionsDashboard-CR3NZeHw.js} +1 -1
- package/dist/assets/SetupScreen-t6wrhv6l.js +1 -0
- package/dist/assets/SkillDetailView-D6TOvMQU.js +3 -0
- package/dist/assets/{SpecsView-DhuaZcOl.js → SpecsView-BYiJr__T.js} +1 -1
- package/dist/assets/TechStackView-HEMM3PkG.js +1 -0
- package/dist/assets/{TerminalPanel-DjruTcb6.js → TerminalPanel-BgMsGfGa.js} +1 -1
- package/dist/assets/{Toaster-BmyghnqJ.js → Toaster-EXqX2jqp.js} +1 -1
- package/dist/assets/{activity-C34aPcFU.js → activity-BBPMHCAJ.js} +1 -1
- package/dist/assets/{activity-CBdzUJQ_.js → activity-BJijwuIr.js} +1 -1
- package/dist/assets/{activity-Wr0_Gb8A.js → activity-DReNmuta.js} +1 -1
- package/dist/assets/{activity-CLYyxeC6.js → activity-DeEOo2zu.js} +1 -1
- package/dist/assets/{activity-Cv_EIWjY.js → activity-Dyh19u3P.js} +1 -1
- package/dist/assets/{activity-Bo6DncWg.js → activity-GR8KiHvf.js} +1 -1
- package/dist/assets/{activity-kCY0dGRC.js → activity-iuGHFz2B.js} +1 -1
- package/dist/assets/button-DwmC7ENW.js +1 -0
- package/dist/assets/{chat-store-B2CjP2Zl.js → chat-store-LHzJqRCp.js} +2 -2
- package/dist/assets/{codemap-activity-store-Cz0_AHqt.js → codemap-activity-store-B6n7KiS8.js} +1 -1
- package/dist/assets/codemap-index-store-oapPwtvI.js +1 -0
- package/dist/assets/{dialog-BJef9ZZo.js → dialog-DsCmc6eL.js} +1 -1
- package/dist/assets/{empty-state-BGzRrNXI.js → empty-state-02bIS4x7.js} +1 -1
- package/dist/assets/{i18n-2wGPPdl_.js → i18n-DxnYsmc-.js} +2 -2
- package/dist/assets/index-Bf75VrDE.js +132 -0
- package/dist/assets/index-NFp5CXyK.css +1 -0
- package/dist/assets/{input-Bd10nfMj.js → input-UhWgodVi.js} +1 -1
- package/dist/assets/{mailbox-store-D3omLzBk.js → mailbox-store-xh2Ux-Xs.js} +1 -1
- package/dist/assets/{progress-ring-BEULkQ1r.js → progress-ring-C0O73ZjR.js} +1 -1
- package/dist/assets/{roster-ws-BmV_3U6w.js → roster-ws-DlQQL7Eh.js} +1 -1
- package/dist/assets/{session-store-ZMNU48xK.js → session-store-BE_S1f5v.js} +1 -1
- package/dist/assets/settings-B5xal2R3.js +1 -0
- package/dist/assets/settings-BHtFy8EG.js +1 -0
- package/dist/assets/settings-Bss5hBla.js +1 -0
- package/dist/assets/settings-BzrLCVRP.js +1 -0
- package/dist/assets/settings-C7RdvmLZ.js +1 -0
- package/dist/assets/settings-Dd94HoV6.js +1 -0
- package/dist/assets/settings-Dm9THFe8.js +1 -0
- package/dist/assets/{shared-CrX8iE-U.js → shared-bBntASiy.js} +1 -1
- package/dist/assets/{stores-DyQOSkkD.js → stores-BS-Bdi-5.js} +2 -2
- package/dist/assets/{ui-store-di6oY7cy.js → ui-store-C4Ybfoon.js} +1 -1
- package/dist/assets/{useWebSocket-BVFPigcY.js → useWebSocket-x8PMoTq8.js} +3 -3
- package/dist/assets/{utils-CwJvjOcH.js → utils-_s0GyctV.js} +1 -1
- package/dist/assets/{vendor-BTTkQ9Tn.js → vendor-CxV3l5PQ.js} +93 -30
- package/dist/assets/{view-navigation-BMRzqGbq.js → view-navigation-DLdE7qHU.js} +1 -1
- package/dist/assets/ws-client-Cy3oRAmZ.js +1 -0
- package/dist/components/SettingsPanel/ModelCatalogPicker.d.ts +22 -0
- package/dist/components/SettingsPanel/ModelListEditor.d.ts +41 -0
- package/dist/components/SettingsPanel/ModelSchemaEditor.d.ts +32 -0
- package/dist/components/SettingsPanel/ProviderModelsPanel.d.ts +2 -1
- package/dist/index.html +22 -22
- package/dist/index.js +7991 -6939
- package/dist/lib/ws-client.d.ts +6 -1
- package/dist/types/client-message.d.ts +19 -0
- package/dist/types/system.d.ts +3 -2
- package/package.json +8 -8
- package/dist/assets/CodeEditor-BlqaT56D.js +0 -1
- package/dist/assets/CodeMap-Bj5tjjW5.js +0 -1
- package/dist/assets/GoalView-DIx7Zr4a.js +0 -1
- package/dist/assets/KanbanView-DshzDwq1.js +0 -3
- package/dist/assets/MailboxDetailView-BJXpXjtm.js +0 -1
- package/dist/assets/MemoryManager-B-S5oREO.js +0 -1
- package/dist/assets/OfficeMapPanel-CBN9uG80.js +0 -4
- package/dist/assets/SddHub-CpRHXmjm.js +0 -2
- package/dist/assets/SetupScreen-B81fcNgP.js +0 -1
- package/dist/assets/SkillDetailView-BTvgE_MD.js +0 -3
- package/dist/assets/TechStackView-BXmfl2qY.js +0 -1
- package/dist/assets/button-BMECp1cg.js +0 -1
- package/dist/assets/codemap-index-store-B-XLZpJu.js +0 -1
- package/dist/assets/index-DeA8UyiB.css +0 -1
- package/dist/assets/index-x6-rLl5H.js +0 -132
- package/dist/assets/settings-BF0lRxlj.js +0 -1
- package/dist/assets/settings-CP6cwqHD.js +0 -1
- package/dist/assets/settings-D0rWEhMg.js +0 -1
- package/dist/assets/settings-DFCaP02p.js +0 -1
- package/dist/assets/settings-DHix1ZPL.js +0 -1
- package/dist/assets/settings-eEzjNzsC.js +0 -1
- package/dist/assets/settings-kp_aIgcX.js +0 -1
- package/dist/assets/ws-client-B0-KwuTK.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-LHzJqRCp.js";import{Bt as n,Ct as r,Di as i,Dn as a,Et as o,Ia as s,Mi as c,Ni as l,Pa as u,Si as d,Sn as f,Vi as p,dt as m,fn as h,ja as g,ln as _,lt as v,mr as y,nr as b,pn as x,ut as S,xn as C}from"./vendor-CxV3l5PQ.js";import"./i18n-DxnYsmc-.js";import{t as ee}from"./useWebSocket-x8PMoTq8.js";import{t as w}from"./utils-_s0GyctV.js";import{m as T,p as E,t as D}from"./stores-BS-Bdi-5.js";import{o as O}from"./view-navigation-DLdE7qHU.js";import{t as k}from"./button-DwmC7ENW.js";import{h as A,m as te,p as ne,y as j}from"./index-Bf75VrDE.js";var M=e(s(),1),N=v(),P={pending:{icon:(0,N.jsx)(c,{className:`w-4 h-4`}),color:`text-muted-foreground`,label:`Pending`},in_progress:{icon:(0,N.jsx)(i,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,N.jsx)(a,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,N.jsx)(l,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,N.jsx)(h,{className:`w-4 h-4`}),color:`text-info`,label:`Review`},completed:{icon:(0,N.jsx)(p,{className:`w-4 h-4`}),color:`text-success`,label:`Done`}},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:n,agents:a,onAssign:o,compact:s,className:c}){let{t:l}=g(),u=P[e.status],[d,f]=(0,M.useState)(!1),p=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`,p?`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`,u.color),role:`img`,"aria-label":p?l(`common:status.inProgress`):void 0,children:u.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`,p?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[p&&(0,N.jsx)(i,{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`)}),n&&(e.status===`failed`||e.status===`completed`)&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,N.jsx)(h,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),o&&a&&a.length>0&&(d?(0,N.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),f(!1)},onBlur:()=>f(!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`)}),a.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>f(!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)(r,{className:`w-3 h-3`}),` `,l(`activity:task.assign`)]}))]})]})}var z=[{key:`pending`,label:`Pending`,match:[`pending`,`blocked`]},{key:`in_progress`,label:`In Progress`,match:[`in_progress`]},{key:`review`,label:`Review`,match:[`review`]},{key:`failed`,label:`Failed`,match:[`failed`]},{key:`completed`,label:`Done`,match:[`completed`]}],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}=g(),n=E(e=>e.phases),r=E(e=>e.multiBoard),[i,a]=(0,M.useState)(`phase`),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(null),[u,f]=(0,M.useState)(0),p=Math.min(u,Math.max(0,n.length-1)),m=r?n[p]:void 0,h=(0,M.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),v=(0,M.useMemo)(()=>[...new Set(h.map(e=>e.assignee).filter(e=>!!e))],[h]),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=>{j({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]),T=(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 A(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:h.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)(_,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r&&m?(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:()=>f(t),className:w(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===p?`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:m,allTasks:h,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:A,dropToPhase:T,dropToStatus:D,onAddTask:C})]}):(0,N.jsx)(H,{phases:n,allTasks:h,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:A,dropToPhase:T,dropToStatus:D,onAddTask:C})]})}function V({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:i,dropToPhase:a,onAddTask:o,dragId:s,hoverKey:c}){let{t:l}=g();return(0,N.jsxs)(`div`,{...i(`phase:${e.id}`,()=>a(e.id)),className:w(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,c===`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:()=>o(e.id),title:l(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,N.jsx)(C,{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:l(`activity:board.dropHere`)}):t.map(e=>(0,N.jsx)(`div`,{...r(e.id),className:w(s===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:u}){let d=t.filter(t=>t.phaseId===e.id),{t:f}=g();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:d,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,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:f(`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=d.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}=g();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:r}=ee(),{t:i}=g(),s=E(e=>e.phases),c=E(e=>e.overallPercent),l=E(e=>e.autonomous),d=E(e=>e.title),p=E(e=>e.goal),h=E(e=>e.status),_=E(e=>e.lastError),v=E(e=>e.graphs);(0,M.useEffect)(()=>{r?.send?.({type:`goal.list`}),r?.send?.({type:`goal.state`})},[r]);let j=D(e=>e.worktrees),P=D(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=T(e=>e.result),Y=T(e=>e.loading),X=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(X.current&&clearTimeout(X.current),!F.trim()){T.getState().clear();return}return X.current=setTimeout(()=>{T.getState().setLoading();let e=T.getState().nextSeq();r?.send?.({type:`goal.assess`,payload:{goal:F,seq:e}})},800),()=>{X.current&&clearTimeout(X.current)}},[F,r]),(0,M.useEffect)(()=>{!F.trim()&&!L&&T.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 n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:u.t(`activity:goalRun.planningAck`)}),R(e),I(``),r?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:V,multiBoard:U,verifyTasks:G,chimeraReview:q}}),O(`chat`)},[F,L,r,V]),oe=(0,M.useCallback)(()=>{r?.send?.({type:`goal.stop`,payload:{}}),R(null)},[r]),se=(0,M.useCallback)(()=>{r?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[r]),ce=(0,M.useCallback)(()=>{r?.send?.(h===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[r,h]),le=(0,M.useCallback)(()=>{r?.send?.({type:`goal.stop`,payload:{}})},[r]),ue=(0,M.useCallback)(()=>{r?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),R(null),I(``)},[r]),[de,$]=(0,M.useState)(!1),fe=(0,M.useCallback)(()=>{r?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[r]),pe=h===`running`||h===`paused`,me=h===`stopped`||h===`completed`||h===`failed`,he=(0,M.useCallback)(e=>{e&&r?.send?.({type:`goal.load`,payload:{graphId:e}})},[r]);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)(y,{className:`h-5 w-5 text-muted-foreground`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold`,children:Z&&d||`Goal`}),Z&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`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`,h===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:h===`paused`||h===`stopped`?`border-warning/40 bg-warning/10 text-warning`:h===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:_??void 0,children:h})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[v.length>0&&(0,N.jsxs)(`select`,{value:Z?v.find(e=>e.title===d)?.id??``:``,onChange:e=>he(e.target.value),title:i(`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:i(`activity:goalRun.boardsCount`,{count:v.length})}),v.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:i(`activity:goalRun.toggleAutonomousTitle`),className:w(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,l?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(S,{className:`h-3.5 w-3.5`}),` `,i(l?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ce,title:i(h===`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:[h===`paused`?(0,N.jsx)(f,{className:`h-3.5 w-3.5`}):(0,N.jsx)(a,{className:`h-3.5 w-3.5`}),i(h===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:le,title:i(`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)(n,{className:`h-3.5 w-3.5 fill-current`}),` `,i(`activity:goalRun.stop`)]})]}),Z&&me&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ue,title:i(`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)(C,{className:`h-3.5 w-3.5`}),` `,i(`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:i(`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:i(`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:i(`common:action.no`)})]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:i(`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`}),` `,i(`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)(x,{className:`h-3 w-3`}),` `,i(`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)(b,{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:i(`activity:goalRun.planning`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`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)(x,{className:`h-3 w-3`}),` `,i(`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)(n,{className:`h-4 w-4 fill-current`}),` `,i(`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)(x,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:i(`activity:goalRun.startHeading`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`activity:goalRun.startBody`)})]}),(0,N.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:i(`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)(b,{className:`h-3 w-3 animate-spin`}),i(`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:i(`activity:goalRun.assess.realistic`)}):(0,N.jsx)(`span`,{className:`text-warning`,children:i(`activity:goalRun.assess.durationConcern`)})}),J.durationClaimed&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:i(`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:i(`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:i(`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:i(`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`}),i(`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`}),i(`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`}),i(`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`}),i(`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:()=>T.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:i(`activity:goalRun.assess.overrideTitle`),children:i(`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?i(`activity:goalRun.assess.disableTitle`):``,children:[(0,N.jsx)(f,{className:`h-4 w-4`}),i(`activity:goalRun.startButton`)]})]}),(0,N.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[i(`activity:goalRun.ctrlHint`),` ·`,` `,i(V?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),j.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:i(`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:i(`activity:goalRun.graph`)})]}),(0,N.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,N.jsx)(ne,{}),z?(0,N.jsx)(A,{worktrees:j,baseBranch:P}):(0,N.jsx)(te,{worktrees:j,baseBranch:P})]})]})]})}export{K as GoalView};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bi as t,Bt as n,Dn as r,Ia as i,Mt as a,Ni as o,Oi as s,Ot as c,Pi as l,Qt as u,Rn as d,Si as f,Sn as p,St as m,Ta as h,Ui as g,Un as _,Vi as v,Wt as y,Xi as b,Yi as x,Yn as S,Yt as C,Zt as w,an as T,cn as ee,dt as E,fn as D,gn as O,hi as te,in as ne,jr as re,jt as ie,lt as k,nr as ae,oa as A,pi as oe,pn as se,qi as ce,qr as le,qt as ue,ra as de,ri as fe,rr as pe,sn as me,un as j,va as he,wr as ge,xn as M,yi as _e}from"./vendor-CxV3l5PQ.js";import{n as N}from"./ui-store-C4Ybfoon.js";import{t as ve}from"./ws-client-Cy3oRAmZ.js";import{t as P}from"./utils-_s0GyctV.js";import{t as ye}from"./session-store-BE_S1f5v.js";import{M as be,u as xe,x as F}from"./stores-BS-Bdi-5.js";import{n as Se,t as Ce}from"./ModelPicker-BxYMTEEN.js";import{C as we,S as I,c as Te}from"./index-Bf75VrDE.js";import{n as Ee,t as L}from"./progress-ring-C0O73ZjR.js";var R=e(i(),1);function De(e,t=!0){(0,R.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 z=4320*60*1e3,Oe=new Set([`completed`,`archived`]);function ke(e,t){let n=We(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Be(t.liveAgentIdentities),i=Fe(e,t.defaultReviewStaleAfterMs??z),a=Pe(e),o=[];for(let s of e.tasks)Oe.has(s.status)||(Ae(o,s,t.requireDueDate===!0),je(o,s,n,r),Me(o,s,n,i),a.length>1&&Ne(o,s,a));return o.sort(Ge),{issues:o,counts:{error:o.filter(e=>e.severity===`error`).length,warning:o.filter(e=>e.severity===`warning`).length},affectedTaskCount:new Set(o.map(e=>e.taskId)).size}}function Ae(e,t,n){V(t.description)||H(e,t,`missing-description`,`warning`,`Add a description`),Re(t).length===0&&H(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&&!V(t.dueDate)&&H(e,t,`missing-due-date`,`warning`,`Set a due date`),!He(t.labels)&&!He(t.tags)&&H(e,t,`missing-labels`,`warning`,`Add labels or tags`),!He(t.childTaskIds)&&!He(t.subtasks)&&H(e,t,`missing-subtasks`,`warning`,`Define subtasks`),He(t.successCriteria)||H(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function je(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=Re(t);if(!i||a.length===0||!V(i.leaseId)||!V(i.leaseExpiresAt)){H(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=We(i.leaseExpiresAt);if(o===null||o<=n){H(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}a.some(e=>r.has(B(e)))||H(e,t,`abandoned-running-task`,`error`,`Assigned agent is not live`)}function Me(e,t,n,r){if(t.status!==`review`)return;let i=Le(t,`review`)??We(t.updatedAt);i===null||n-i<=r||H(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/(3600*1e3)))}h`)}function Ne(e,t,n){let r=Ie(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[B(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(B(a.state)),c=i.get(B(o.state));if(!(s===void 0||c===void 0||Math.abs(c-s)<=1)){H(e,t,`skipped-lifecycle-state`,`error`,`Lifecycle skipped ${a.state} → ${o.state}`);return}}}function Pe(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=ze(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=>V(e));if(e.length===5)return e}for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=ze(e);if(t.length>1)return t}}return[]}function Fe(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(Ue(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(Ue(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(Ue(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function Ie(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`&&V(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=Ve(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:We(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Le(e,t){let n=null;for(let r of Ie(e))B(r.state)!==B(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function Re(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(V)}function ze(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(V(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=Ve(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function Be(e){let t=new Set;if(!e)return t;for(let n of e)V(n)&&t.add(B(n));return t}function B(e){return e.trim().toLocaleLowerCase()}function Ve(...e){for(let t of e)if(V(t))return t.trim();return null}function V(e){return typeof e==`string`&&e.trim().length>0}function He(e){return Array.isArray(e)&&e.length>0}function Ue(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function We(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 H(e,t,n,r,i){e.push({id:`${t.id}:${n}`,taskId:t.id,taskTitle:t.title,code:n,severity:r,message:i})}function Ge(e,t){let n=Ke(e.severity)-Ke(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function Ke(e){return e===`error`?0:1}function qe(e){let t=be(e=>e.wsUrl),n=be(e=>e.provider),r=be(e=>e.model),[i,a]=(0,R.useState)([]),[o,s]=(0,R.useState)([]),[c,l]=(0,R.useState)({}),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(``);return(0,R.useEffect)(()=>{let e=ve(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,R.useEffect)(()=>{e&&ve(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}var U=k();function W({options:e,selected:t,onChange:n,placeholder:r,emptyLabel:i}){let[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),l=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!a)return;let e=e=>{l.current&&!l.current.contains(e.target)&&o(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]);let u=(0,R.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),d=(0,R.useMemo)(()=>{let t=s.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,s]),f=e=>{n(t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,U.jsxs)(`div`,{ref:l,className:`relative`,children:[t.length>0&&(0,U.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:t.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`max-w-[150px] truncate`,children:u(e)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${u(e)}`,children:(0,U.jsx)(E,{size:11})})]},e))}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>o(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,U.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:r??`Add…`}),(0,U.jsx)(x,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),a&&(0,U.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,U.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,U.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Filter…`,className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),s&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>c(``),className:`text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(E,{className:`h-3 w-3`})})]}),(0,U.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[d.map(e=>{let n=t.includes(e.value);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>f(e.value),className:P(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,n?`bg-primary/8 text-primary`:`text-foreground`),children:[n?(0,U.jsx)(b,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,U.jsx)(`span`,{className:`w-3 shrink-0`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),d.length===0&&(0,U.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?i??`Nothing available`:`No match`})]})]})]})}function Je(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 Ye(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 Xe({presence:e=[]}){return e.length===0?null:(0,U.jsxs)(`section`,{"aria-label":`Board presence`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-card/50 px-4 py-2`,children:[(0,U.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Live board users`}),e.map(e=>(0,U.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,U.jsx)(`span`,{role:`img`,"aria-label":e.active?`active`:`inactive`,className:P(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,U.jsx)(l,{size:13,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,U.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,U.jsx)(s,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,U.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:Je(e.lastSeenAt)})]},e.id))]})}function Ze({board:e,snapshot:t,sendKanban:n}){let[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(!0),[s,c]=(0,R.useState)(`deterministic`),[l,u]=(0,R.useState)(`session`),[d,f]=(0,R.useState)(``),[p,m]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),[v,y]=(0,R.useState)([]),[b,S]=(0,R.useState)([]),[C,T]=(0,R.useState)(10),E=Se(r&&s===`agentic`),D=qe(r&&s===`agentic`);(0,R.useEffect)(()=>{let t=e.supervisor;o(t?.enabled??!0),c(t?.mode??`deterministic`),u(t?.routing?.mode??`session`),f(t?.routing?.provider??``),m(t?.routing?.model??``),_(t?.routing?.fallbackProfile??``),y(t?.routing?.fallbackModels??[]),S(t?.skills??[]),T(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,e.supervisor]);let O=()=>{let t={mode:l,...l===`fixed`&&d?{provider:d}:{},...l===`fixed`&&p?{model:p}:{},...l===`fallback_profile`&&g?{fallbackProfile:g}:{},...v.length?{fallbackModels:v}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:a,mode:s,intervalMs:Math.max(2,C)*1e3,recoveryMode:`auto`,...s===`agentic`?{routing:t,skills:b}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},te=a?t?.status??`starting`:`disabled`;return(0,U.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(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,U.jsx)(w,{size:13,className:te===`healthy`?`text-success`:`text-warning`}),(0,U.jsx)(`span`,{className:`font-semibold`,children:`Kanban Agent`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[s,` · `,te]}),t?.summary&&(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,U.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?`checked ${Ye(t.lastAuditAt)} ago`:`not checked`}),(0,U.jsx)(x,{size:13,className:P(`transition-transform`,r&&`rotate-180`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),(0,U.jsx)(`span`,{children:`Watch this board`})]}),(0,U.jsx)(Qe,{label:`Supervisor engine`,value:s,options:[`deterministic`,`agentic`],onChange:e=>c(e)}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Audit interval (seconds)`}),(0,U.jsx)(`input`,{type:`number`,min:2,value:C,onChange:e=>T(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,U.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,U.jsx)(ee,{size:13}),` Save`]}),(0,U.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,U.jsx)(h,{size:13}),` Audit now`]})]}),s===`deterministic`?(0,U.jsx)(`div`,{className:`lg:col-span-4 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-muted-foreground`,children:`Deterministic mode uses no provider, model, token, or billing. It repairs assignment/status/column drift and recovers expired leases.`}):(0,U.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,U.jsx)(Qe,{label:`Kanban Agent model source`,value:l,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>u(e)}),l===`fixed`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,U.jsx)(Ce,{value:p||void 0,provider:d||void 0,candidates:E,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{m(e),f(t)}})]}),l===`fallback_profile`&&(0,U.jsx)(Qe,{label:`Fallback profile (first model is primary)`,value:g,options:Object.keys(D.fallbackProfiles),placeholder:`Select configured profile…`,onChange:_}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Supervisor skills`}),(0,U.jsx)(W,{options:D.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:b,onChange:S,placeholder:`Force-load agentic skills…`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Extra fallback models`}),(0,U.jsx)(W,{options:E.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:v,onChange:y,placeholder:`Optional ordered fallbacks…`})]})]})]})]})}function Qe({label:e,value:t,options:n,onChange:r,placeholder:i}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,U.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,U.jsx)(`option`,{value:``,children:i}),n.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})]})}function $e(e){let t=new Set;for(let n of e)n.status===`running`&&(t.add(n.id),t.add(n.name));return t}function et(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 tt(e,t){return e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&t.includes(e.slice(8)))===!0}function nt(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 rt(e){let t=e?.tags??[],n=t.includes(`sdd`)?`sdd`:t.includes(`goal`)?`goal`:null;if(!n)return null;let r=t.find(e=>e.startsWith(`run:`))?.slice(4);return{engine:n,...r?{runId:r}:{}}}function it({boardTotal:e,activeBoardTotal:t,orphanedBoardTotal:n,activeBoardId:r,activeBoards:i,orphanedBoards:a,boardPage:o,boardPageSize:s,loading:c,newBoardTitle:l,onClose:u,onRefresh:d,onNewBoardTitleChange:p,onCreateBoard:m,onBoardSelect:h,onBoardPageChange:g}){return(0,U.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,U.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,U.jsx)(`button`,{type:`button`,title:`Back`,onClick:u,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(he,{size:16})}),(0,U.jsx)(f,{size:17,className:`text-primary`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Kanban`}),(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[e,` boards · `,t,` active · `,n,` orphaned`]})]}),(0,U.jsx)(`button`,{type:`button`,title:`Refresh`,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,U.jsx)(O,{size:15,className:c?`animate-spin`:void 0})})]}),(0,U.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,U.jsx)(`input`,{value:l,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m()},placeholder:`New board`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,title:`Create board`,onClick:m,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,U.jsx)(M,{size:16})})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[i.length>0&&(0,U.jsxs)(`div`,{className:`mb-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-success`,children:[`Active session · `,t]}),i.map(e=>(0,U.jsx)(at,{board:e,active:r===e.id,dotClassName:`bg-success`,onSelect:h},e.id)),a.length>0&&(0,U.jsxs)(`div`,{className:`mb-1 mt-2 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`No active session · `,n]}),a.map(e=>(0,U.jsx)(at,{board:e,active:r===e.id,dotClassName:`bg-muted-foreground/45`,onSelect:h},e.id))]}),(0,U.jsx)(I,{page:o,pageSize:s,totalItems:e,onPageChange:g,compact:!0,itemLabel:`boards`})]})}function at({board:e,active:t,dotClassName:n,onSelect:r}){return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:P(`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,U.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(`span`,{className:P(`h-1.5 w-1.5 rounded-full`,n)}),e.taskCount,` tasks`]}),(0,U.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]})}var ot={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function st({title:e,value:t,inherited:n,onSave:r}){let[i,a]=(0,R.useState)(t??ot),[o,s]=(0,R.useState)(lt(t?.allow??[])),[c,l]=(0,R.useState)(lt(t?.deny??[])),[u,d]=(0,R.useState)(null);return(0,R.useEffect)(()=>{a(t??ot),s(lt(t?.allow??[])),l(lt(t?.deny??[])),d(null)},[t]),(0,U.jsxs)(`details`,{className:`rounded-md border border-primary/25 bg-primary/5`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(w,{size:14,className:`text-primary`}),(0,U.jsx)(`span`,{children:e}),(0,U.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,U.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[n?.enabled&&(0,U.jsx)(`div`,{className:`rounded border border-warning/25 bg-warning/10 px-2 py-1.5 text-muted-foreground`,children:`Board policy remains authoritative. This task policy can only narrow that scope.`}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:e=>a({...i,enabled:e.target.checked})}),`Enable this boundary layer`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Outside scope`}),(0,U.jsxs)(`select`,{value:i.enforcement,onChange:e=>a({...i,enforcement:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,U.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,U.jsx)(`option`,{value:`block`,children:`Always block`})]})]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Shell / opaque tools`}),(0,U.jsxs)(`select`,{value:i.shellAccess,onChange:e=>a({...i,shellAccess:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,U.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,U.jsx)(`option`,{value:`block`,children:`Always block`}),(0,U.jsx)(`option`,{value:`allow`,children:`Allow`})]})]})]}),(0,U.jsx)(ct,{label:`Allow selectors`,value:o,onChange:s}),(0,U.jsx)(ct,{label:`Deny selectors`,value:c,onChange:l}),(0,U.jsx)(`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. Shell “Allow” is opaque and can cross path selectors.`}),u&&(0,U.jsx)(`div`,{className:`text-destructive`,children:u}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=ut(o),t=ut(c);r({...i,allow:e,...t.length?{deny:t}:{}}),d(null)}catch(e){d(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,U.jsx)(ee,{size:13}),` Save boundary`]}),t&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:`Remove layer`})]})]})]})}function ct({label:e,value:t,onChange:n}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,U.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 lt(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
+
`)}function ut(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(!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 dt({audit:e,onSelectTask:t}){let[n,r]=(0,R.useState)(!0),i=(0,R.useId)();if((0,R.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let a=ft(e.issues);return(0,U.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,U.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,U.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,U.jsx)(y,{size:14,"aria-hidden":`true`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.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,U.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,U.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,U.jsx)(g,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,U.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,U.jsx)(c,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,U.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,U.jsx)(x,{size:14,"aria-hidden":`true`,className:P(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,U.jsx)(`ul`,{id:i,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:a.map(({taskId:e,taskTitle:n,issues:r})=>(0,U.jsx)(`li`,{children:(0,U.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,U.jsx)(`span`,{className:P(`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,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,U.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 ft(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}function pt({board:e,sendKanban:t,onSelectTask:n}){let[r,i]=(0,R.useState)(!1),a=e.tasks.filter(e=>e.decomposition?.status===`proposed`);return a.length?(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-warning/30 bg-warning/5 px-4 py-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`flex w-full items-center gap-2 text-left text-xs font-semibold text-warning`,children:[r?(0,U.jsx)(ce,{size:13}):(0,U.jsx)(x,{size:13}),(0,U.jsx)(me,{size:13}),a.length,` decomposition proposal`,a.length>1?`s`:``,` awaiting approval`]}),!r&&(0,U.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:a.map(r=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(r.id),className:`min-w-0 flex-1 truncate text-left hover:underline`,children:[r.title,(0,U.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`→ `,r.decomposition?.proposedSubtasks.length??0,` subtasks`]})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(`kanban.decomposition.approve`,{boardId:e.id,taskId:r.id,proposalId:r.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,U.jsx)(b,{size:12}),` Approve`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(`kanban.decomposition.reject`,{boardId:e.id,taskId:r.id,proposalId:r.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,U.jsx)(E,{size:12}),` Reject`]})]},r.id))})]}):null}var mt=[`assessed`,`proposed`,`approval`,`applied`];function ht(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function gt({board:e,task:t,sendKanban:n,onSelectTask:r}){let i=t.decomposition,a=ht(t),o=(0,R.useMemo)(()=>{if(!i)return null;let n=(i.appliedChildTaskIds??[]).map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return{tasks:[{id:t.id,shortId:`parent`,title:t.title,displayStatus:i.status===`applied`?`completed`:`in_progress`,priority:t.priority,deps:[]},...i.proposedSubtasks.map((e,r)=>{let a=n[r];return{id:a?.id??`proposed-${r}`,shortId:`s${r}`,title:e.title,displayStatus:a?a.status===`completed`?`completed`:a.status===`failed`?`failed`:a.status===`in_progress`?`in_progress`:`pending`:i.status===`approved`?`queued`:`pending`,priority:t.priority,deps:(e.dependsOnIndex??[]).map(e=>`s${e}`)}})],columns:[{label:`Parent`,taskIds:[`parent`]},{label:i.status===`applied`?`Subtasks`:`Proposed subtasks`,taskIds:i.proposedSubtasks.map((e,t)=>`s${t}`)}],appliedChildren:n}},[e,i,t]);return!i&&!t.atomicityAssessment?null:(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border p-3`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,U.jsx)(me,{size:13}),`Decomposition`]}),(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 text-[11px]`,children:[mt.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`→`}),(0,U.jsx)(`span`,{className:P(`rounded px-1.5 py-0.5`,i?.status===`rejected`&&t===2?`bg-destructive/10 text-destructive`:t<=a?`bg-primary/10 font-medium text-primary`:`bg-muted text-muted-foreground`),children:i?.status===`rejected`&&t===2?`rejected`:e})]},e)),t.atomicityAssessment&&(0,U.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[t.atomicityAssessment.verdict,` · score `,t.atomicityAssessment.score]})]}),!i&&t.atomicityAssessment?.verdict===`needs_decomposition`&&(0,U.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2 text-[11px] text-warning`,children:[`This task should be split before dispatch:`,(0,U.jsx)(`ul`,{className:`ml-4 mt-1 list-disc`,children:t.atomicityAssessment.criteria.filter(e=>e.score<1).map(e=>(0,U.jsx)(`li`,{children:e.reason},e.id))})]}),i&&o&&(0,U.jsxs)(U.Fragment,{children:[i.rationale&&(0,U.jsxs)(`div`,{className:`mb-2 text-[11px] text-muted-foreground`,children:[`“`,i.rationale,`”`]}),(0,U.jsx)(`div`,{className:`h-64 overflow-hidden rounded-md border`,children:(0,U.jsx)(Ee,{tasks:o.tasks,columns:o.columns,onTaskClick:t=>{e.tasks.some(e=>e.id===t)&&r(t)}})}),(0,U.jsx)(`ul`,{className:`mt-2 space-y-1 text-[11px]`,children:i.proposedSubtasks.map((e,t)=>(0,U.jsxs)(`li`,{className:`rounded bg-muted/40 px-2 py-1`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.title}),e.successCriteria?.length?(0,U.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`✓ `,e.successCriteria.join(` · `)]}):null]},`${e.title}-${t}`))}),i.status===`proposed`&&(0,U.jsxs)(`div`,{className:`mt-2 flex gap-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.approve`,{boardId:e.id,taskId:t.id,proposalId:i.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,U.jsx)(b,{size:13}),` Approve & split`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.reject`,{boardId:e.id,taskId:t.id,proposalId:i.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,U.jsx)(E,{size:13}),` Reject`]})]}),i.status===`applied`&&o.appliedChildren.length>0&&(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.appliedChildren.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`rounded-md border px-2 py-1 text-[11px] hover:bg-muted`,children:[e.title,(0,U.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`[`,e.status,`]`]})]},e.id))}),i.status===`rejected`&&i.resolutionReason&&(0,U.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Rejected: `,i.resolutionReason]})]})]})}var _t=[`id`,`name`,`type`];function G(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 _t){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function vt(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var yt=new Set([`completed`,`review`,`failed`]);function bt(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(yt.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 xt(e){let t=new Map(e.tasks.map(e=>[e.id,e])),n=new Set,r=(e,i)=>{n.add(e.id);let a=e.childTaskIds??[],o=[];for(let e of a){let a=t.get(e);!a||n.has(a.id)||o.push(r(a,i+1))}return{task:e,children:o,depth:i}},i=[];for(let a of e.tasks)a.parentTaskId&&t.get(a.parentTaskId)||n.has(a.id)||i.push(r(a,0));return i}function St(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 Ct(e,t){return e?.columns.find(e=>e.id===t)?.title??t}function wt({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function K({label:e,value:t,onChange:n}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,U.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 q({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,U.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,U.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})]})}function Tt(e){let t=`rounded px-1.5 py-0.5`;return e===`critical`?`${t} bg-destructive/10 text-destructive`:e===`high`?`${t} bg-warning/10 text-warning`:e===`low`?`${t} bg-muted text-muted-foreground`:`${t} bg-info/10 text-info`}function Et(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Dt(e){return e===`completed`||e===`failed`||e===`cancelled`}function Ot(e,t){return t?Math.round(e/t*100):0}function kt(e,t,n,r=new Date){let i=[],a=n.filter(e=>e.taskId===t.id),o=a.filter(e=>e.type!==`task.created`),s=o.filter(e=>e.type!==`task.assignment.heartbeat`&&e.type!==`task.assignment.snapshot`),c=s.filter(e=>!!e.note?.trim()),l=t.assignment,u=r.getTime(),d=100,f=(e,t=0)=>{i.some(t=>t.id===e.id)||(i.push(e),d=Math.max(0,d-t))};t.dueDate&&![`completed`,`archived`].includes(t.status)&&Date.parse(t.dueDate)<u&&f({id:`overdue`,severity:`critical`,category:`operational`,title:`Task is overdue`,detail:`Due date ${t.dueDate} has passed while status is ${t.status}.`,remediation:`Re-plan the due date or record the blocker and owner response.`});let p=(t.dependsOn??[]).filter(t=>!e.tasks.some(e=>e.id===t));p.length&&f({id:`missing-dependency`,severity:`critical`,category:`operational`,title:`Dependency references are broken`,detail:`${p.length} dependency task${p.length===1?``:`s`} cannot be found.`,remediation:`Repair or remove the missing dependency IDs before dispatch.`});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`,title:`Dependencies are unresolved`,detail:`${m.length} dependency task${m.length===1?``:`s`} still block execution.`,remediation:`Complete dependencies or explicitly waive them with a decision event.`}),(l?.status===`failed`||l?.error)&&f({id:`assignment-failed`,severity:`critical`,category:`operational`,title:`Latest agent run failed`,detail:l.error??l.lastFailureKind??`Assignment status is failed.`,remediation:`Review the failed attempt evidence, adjust routing, then retry or block the task.`}),l?.status===`failed`&&l.maxAttempts!==void 0&&(l.attempt??0)>=l.maxAttempts&&f({id:`retry-exhausted`,severity:`critical`,category:`operational`,title:`Retry budget is exhausted`,detail:`${l.attempt??0}/${l.maxAttempts} attempts have been consumed.`,remediation:`Escalate for a new route or explicitly increase the attempt budget.`}),l&&[`queued`,`running`].includes(l.status)&&l.leaseExpiresAt&&Date.parse(l.leaseExpiresAt)<=u&&f({id:`lease-expired`,severity:`critical`,category:`operational`,title:`Assignment lease has expired`,detail:`Lease expired at ${l.leaseExpiresAt} while run status is ${l.status}.`,remediation:`Recover, release, or retry the stale assignment.`}),l?.status===`running`&&l.heartbeatAt&&u-Date.parse(l.heartbeatAt)>5*6e4&&f({id:`heartbeat-stale`,severity:`warning`,category:`operational`,title:`Agent heartbeat is stale`,detail:`No heartbeat has been recorded since ${l.heartbeatAt}.`,remediation:`Inspect the subagent/run and recover the assignment if it is no longer alive.`}),t.status===`in_progress`&&!l&&f({id:`unowned-in-progress`,severity:`warning`,category:`operational`,title:`In-progress task has no assignment`,detail:`The task claims active work but has no inspectable agent assignment.`,remediation:`Assign an agent or return the task to ready/blocked.`});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`,title:`Acceptance checks failed`,detail:`${h.length} completion check${h.length===1?``:`s`} failed.`,remediation:`Resolve or explicitly waive failed acceptance evidence.`}),t.status===`completed`&&g.length&&f({id:`completed-with-pending-checks`,severity:`critical`,category:`operational`,title:`Completed task still has pending checks`,detail:`${g.length} acceptance check${g.length===1?``:`s`} remain pending.`,remediation:`Move the task back to review or complete the missing checks.`}),a.length?a.some(e=>e.type===`task.created`)||f({id:`missing-creation-event`,severity:`warning`,category:`audit`,title:`Creation provenance is missing`,detail:`The loaded event range does not contain task.created.`,remediation:`Load deeper history or record the legacy origin explicitly.`},10):f({id:`no-durable-events`,severity:`critical`,category:`audit`,title:`No durable activity events loaded`,detail:`Current state cannot be traced to an append-only task event.`,remediation:`Refresh activity; migrate legacy state or record an observation event.`},25);let _=Ot(o.filter(e=>!!e.actor).length,o.length),v=Ot(o.filter(e=>!!e.sessionId).length,o.length),y=Ot(c.length,s.length);o.length&&_<100&&f({id:`actor-coverage`,severity:`warning`,category:`audit`,title:`Some mutations have no actor`,detail:`Actor coverage is ${_}%.`,remediation:`Ensure every route/tool mutation supplies agent or operator identity.`},10),o.length&&v<100&&f({id:`session-coverage`,severity:`warning`,category:`audit`,title:`Some mutations have no session`,detail:`Session coverage is ${v}%.`,remediation:`Propagate session identity into all task event contexts.`},10),s.length&&y<50&&f({id:`reason-coverage`,severity:`info`,category:`audit`,title:`Decision rationale is sparse`,detail:`Only ${y}% of mutations include a reason or outcome.`,remediation:`Use the change-reason and decision/outcome fields for meaningful mutations.`},10);let b={...Et([...a].sort((e,t)=>t.ts.localeCompare(e.ts)).find(e=>e.type===`task.assigned`||e.type.startsWith(`task.assignment.`))?.after),...l??{}},x=!!(b.provider||b.model||b.modelRouting);l&&!x&&f({id:`missing-route`,severity:`warning`,category:`audit`,title:`Execution route is not inspectable`,detail:`Assignment has no routing mode, provider, or model.`,remediation:`Reassign with explicit session/fixed/fallback routing metadata.`},10);let S=!!(l?.lastResult||l?.error||a.some(e=>Dt(String(Et(e.after).status??``))&&!!e.note?.trim()));return Dt(l?.status)&&!S&&f({id:`missing-terminal-evidence`,severity:`critical`,category:`audit`,title:`Terminal run has no result or error evidence`,detail:`Assignment ended as ${l?.status} without an inspectable output.`,remediation:`Record the final result/error and supporting evidence.`},15),i.sort((e,t)=>{let n={critical:0,warning:1,info:2};return n[e.severity]-n[t.severity]}),{score:d,findings:i,critical:i.filter(e=>e.severity===`critical`).length,warnings:i.filter(e=>e.severity===`warning`).length,coverage:{durableEvents:a.length,actorPercent:_,sessionPercent:v,reasonPercent:y,hasExecutionRoute:x,hasTerminalEvidence:S}}}function At(e){return e===`critical`?`border-destructive/30 bg-destructive/5 text-destructive`:e===`warning`?`border-warning/30 bg-warning/5 text-warning`:`border-info/30 bg-info/5 text-info`}function jt({board:e,task:t,events:n}){let r=kt(e,t,n),i=we(r.findings,8,t.id);return(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(u,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Risk & audit quality`}),(0,U.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r.score>=90?`bg-success/10 text-success`:r.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:[`audit `,r.score,`/100`]}),r.critical>0&&(0,U.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:[r.critical,` critical`]}),(0,U.jsx)(x,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1 text-center sm:grid-cols-6`,children:[[`Events`,r.coverage.durableEvents],[`Actor`,`${r.coverage.actorPercent}%`],[`Session`,`${r.coverage.sessionPercent}%`],[`Reasons`,`${r.coverage.reasonPercent}%`],[`Route`,r.coverage.hasExecutionRoute?`yes`:`no`],[`Outcome`,r.coverage.hasTerminalEvidence?`yes`:`no`]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,U.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),r.findings.length===0?(0,U.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,U.jsx)(v,{className:`size-4`}),` No deterministic task risks detected.`]}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[i.pageItems.map(e=>(0,U.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${At(e.severity)}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,U.jsx)(te,{className:`size-3.5`}):(0,U.jsx)(c,{className:`size-3.5`}),e.title,(0,U.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[e.category,` · `,e.severity]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:e.detail}),(0,U.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,U.jsx)(`strong`,{children:`Next:`}),` `,e.remediation]})]},e.id)),(0,U.jsx)(I,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`risk findings`})]})]})]})}function Mt(e,t,n){let r=t.assignment,i=kt(e,t,[]).findings.filter(e=>e.category===`operational`),a=G(r?.provider),o=G(r?.model);return{owner:G(r?.name)??G(r?.agentId)??G(r?.role)??G(t.assignee)??G(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:vt(t,n?.[`${e.id}:${t.id}`]),subtaskCounts:(()=>{let n=t.childTaskIds??[];if(!n.length)return null;let r=n.map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return r.length?{done:r.filter(e=>[`completed`,`review`,`archived`].includes(e.status)).length,total:r.length}:null})(),atomicityVerdict:t.atomicityAssessment?.verdict??null,evidenceCount:t.verificationReport?.attachments.length??0,pendingDecomposition:t.decomposition?.status===`proposed`}}function Nt({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let c=xe(e=>e.verificationActivity),l=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,U.jsxs)(`section`,{className:P(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,l.length===0?`w-[180px]`:`w-[310px]`),children:[(0,U.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,U.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,U.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:l.length})]}),(0,U.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragOver:e=>e.preventDefault(),onDrop:n=>{n.preventDefault(),e.lifecycle?.mode!==`managed`&&r&&s(r,t.id),i(null)},children:l.map(t=>{let r=Mt(e,t,c);return(0,U.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&i(t.id)},onDragEnd:()=>i(null),className:P(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,n===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>a(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(t.atomic||r.atomicityVerdict)&&(0,U.jsx)(`span`,{className:P(`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,U.jsx)(`span`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title})]}),t.description&&(0,U.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,U.jsx)(`button`,{type:`button`,title:`Delete task`,"aria-label":`Delete task: ${t.title}`,onClick:()=>o(t),className:`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,U.jsx)(ie,{size:14})})]}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:Tt(t.priority),children:t.priority}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),r.owner!==`Unassigned`&&(0,U.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:r.owner}),t.assignment&&(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:r.route}),t.assignment?.attempt?(0,U.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,r.attempts]}):null,r.fallbackCount>0&&(0,U.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.fallbackCount,` fallback`]}),r.blockers>0?(0,U.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.blockers,` blocker`]}):null,r.activeUsers>0&&(0,U.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[r.activeUsers,` active`]}),r.failed&&(0,U.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:`run failed`}),r.criticalRisks>0&&(0,U.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[r.criticalRisks,` critical risk`]}),r.warningRisks>0&&(0,U.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.warningRisks,` warning`]}),t.chain&&(0,U.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,U.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,U.jsxs)(`span`,{className:P(`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,U.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,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:[r.evidenceCount,` evidence`]}),r.pendingDecomposition&&(0,U.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:`split pending approval`})]})]},t.id)})})]})}function Pt({queueHealth:e,runningCostTotal:t}){return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:`Queue health`}),e.counts.ready>0&&(0,U.jsxs)(`span`,{title:`Claimable tasks`,className:`inline-flex items-center gap-1 text-success`,children:[e.counts.ready,` ready`]}),e.counts.running>0&&(0,U.jsxs)(`span`,{title:`Running assignments`,className:`inline-flex items-center gap-1 text-warning`,children:[e.counts.running,` running`]}),e.counts.review>0&&(0,U.jsxs)(`span`,{title:`In review`,className:`inline-flex items-center gap-1 text-primary`,children:[e.counts.review,` review`]}),e.counts.blocked>0&&(0,U.jsxs)(`span`,{title:`Manually blocked`,className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.blocked,` blocked`]}),e.counts.failed>0&&(0,U.jsxs)(`span`,{title:`Failed tasks`,className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.failed,` failed`]}),e.dependencyBlocked.count>0&&(0,U.jsxs)(`span`,{title:`Ready/pending tasks blocked by dependencies`,className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[e.dependencyBlocked.count,` blocked by deps`]}),e.staleAssignments.count>0&&(0,U.jsxs)(`span`,{title:`Expired lease assignments`,className:`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[e.staleAssignments.count,` stale`]}),e.heartbeatDue.count===0&&e.staleAssignments.count===0&&e.dependencyBlocked.count===0&&(0,U.jsx)(`span`,{className:`text-success`,children:`healthy`}),t>0&&(0,U.jsxs)(`span`,{title:`Sum of costCeilingUsd for running/queued tasks`,className:`inline-flex items-center gap-1 text-info`,children:[`~$`,t.toFixed(2),` running cost`]})]})}function Ft({runLink:e,sendRaw:t}){let i=e.engine===`sdd`,a=i?`sdd.board`:`goal`,o=N(e=>e.setCurrentView),s=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,U.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,U.jsx)(se,{size:11}),` `,e.engine]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Live run — steer it from here`}),i&&(0,U.jsxs)(`button`,{type:`button`,className:s,title:`Open the live run view (SDD Hub)`,onClick:()=>o(`sddhub`),children:[(0,U.jsx)(se,{size:12}),` Open live run`]}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`${a}.pause`),children:[(0,U.jsx)(r,{size:12}),` Pause`]}),(0,U.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`${a}.resume`),children:[(0,U.jsx)(p,{size:12}),` Resume`]}),i&&(0,U.jsxs)(`button`,{type:`button`,className:s,onClick:()=>t(`sdd.board.retry_all_failed`),children:[(0,U.jsx)(D,{size:12}),` Retry failed`]}),(0,U.jsxs)(`button`,{type:`button`,className:P(s,`text-destructive hover:bg-destructive/10`),onClick:()=>t(`${a}.stop`),children:[(0,U.jsx)(n,{size:12}),` Stop`]})]})]})}function It({boardId:e,sendKanban:t}){let n=`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,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,U.jsx)(se,{size:13,className:`text-primary`}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Run this board as a live agent job:`}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:`Start as Goal`}),(0,U.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:`Start as SDD`})]})]})}function Lt({runLink:e,runTaskId:t,modelCandidates:r,sendRaw:i}){let a=e.engine===`sdd`,[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,d=()=>{let e=c.trim();e&&(i(a?`sdd.board.reassign`:`goal.assignTask`,{taskId:t,agentName:e}),s(!1),l(``))};return(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Run controls`}),a&&(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Worker model`}),(0,U.jsx)(Ce,{candidates:r,placeholder:`Set model for this task…`,onPick:(e,n)=>i(`sdd.board.set_task_model`,{taskId:t,model:e,provider:n})})]}),o?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d(),e.key===`Escape`&&s(!1)},placeholder:`New worker name`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,U.jsx)(b,{size:14})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,U.jsx)(E,{size:14})})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(a?`sdd.board.retry`:`goal.retryTask`,{taskId:t}),children:[(0,U.jsx)(D,{size:13}),` Retry`]}),(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>s(!0),children:[(0,U.jsx)(m,{size:13}),` Reassign`]}),a?(0,U.jsxs)(`button`,{type:`button`,className:P(u,`text-destructive hover:bg-destructive/10`),onClick:()=>i(`sdd.board.cancel_task`,{taskId:t}),children:[(0,U.jsx)(n,{size:13}),` Cancel`]}):(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(`goal.runTask`,{taskId:t}),children:[(0,U.jsx)(p,{size:13}),` Run now`]})]})]})}var Rt={unverified:{label:`unverified`,className:`bg-muted text-muted-foreground`,icon:C},running:{label:`verifying…`,className:`bg-info/10 text-info`,icon:ae},passed:{label:`verified`,className:`bg-success/10 text-success`,icon:w},failed:{label:`verification failed`,className:`bg-destructive/10 text-destructive`,icon:ue},needs_human:{label:`needs review`,className:`bg-warning/10 text-warning`,icon:c},incomplete:{label:`incomplete`,className:`bg-warning/10 text-warning`,icon:c}};function zt({task:e}){return e.status===`completed`?(0,U.jsx)(b,{size:13,className:`text-success`}):e.status===`failed`?(0,U.jsx)(E,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,U.jsx)(ae,{size:13,className:`animate-spin text-info`}):(0,U.jsx)(t,{size:13,className:`text-muted-foreground`})}function Bt({board:e,selectedTaskId:t,onSelectTask:n}){let r=xe(e=>e.verificationActivity),i=(0,R.useMemo)(()=>St(xt(e)),[e]);return i.length?(0,U.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:i.map(({task:i,depth:a,children:o})=>{let s=Rt[vt(i,r[`${e.id}:${i.id}`])],c=s.icon,l=i.atomicityAssessment?.verdict;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(i.id),style:{paddingLeft:`${a*22+8}px`},className:P(`flex w-full items-center gap-2 rounded-md border py-1.5 pr-2 text-left text-xs transition-colors`,t===i.id?`border-primary bg-primary/5`:`border-transparent hover:border-primary/40 hover:bg-muted/40`),children:[o.length>0?(0,U.jsx)(ce,{size:12,className:`shrink-0 text-muted-foreground`}):(0,U.jsx)(`span`,{className:`w-3 shrink-0`}),(0,U.jsx)(zt,{task:i}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:i.title}),i.atomic&&(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-warning/15 px-1 py-0.5 text-[10px] text-warning`,children:`atomic`}),l&&l!==`atomic`&&(0,U.jsx)(`span`,{className:P(`shrink-0 rounded px-1 py-0.5 text-[10px]`,l===`needs_decomposition`?`bg-destructive/15 text-destructive`:l===`composite`?`bg-info/15 text-info`:`bg-warning/15 text-warning`),children:l===`needs_decomposition`?`split me`:l}),i.decomposition?.status===`proposed`&&(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-warning/10 px-1 py-0.5 text-[10px] text-warning`,children:`proposal pending`}),(0,U.jsxs)(`span`,{className:P(`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px]`,s.className),children:[(0,U.jsx)(c,{size:11,className:s.label===`verifying…`?`animate-spin`:void 0}),s.label]})]})},i.id)})})}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No tasks on this board yet.`})}function Vt({label:e,value:t,tone:n}){return(0,U.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,U.jsx)(`div`,{className:P(`text-xl font-bold`,n===`success`&&`text-success`,n===`destructive`&&`text-destructive`,n===`warning`&&`text-warning`,n===`muted`&&`text-muted-foreground`),children:t}),(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e})]})}function Ht({title:e,icon:t,tone:n,rows:r,onSelectTask:i}){return r.length?(0,U.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,U.jsxs)(`div`,{className:P(`flex items-center gap-2 border-b px-3 py-2 text-xs font-semibold`,n),children:[(0,U.jsx)(t,{size:14}),e,(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:r.length})]}),(0,U.jsx)(`ul`,{className:`divide-y`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.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,U.jsx)(`span`,{className:`font-medium`,children:e.primary}),e.secondary&&(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.secondary})]})},e.id))})]}):null}function Ut({board:e,onSelectTask:t}){let n=(0,R.useMemo)(()=>bt(e),[e]);return(0,U.jsxs)(`div`,{className:`h-full space-y-4 overflow-y-auto p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-4 rounded-md border bg-background p-4`,children:[(0,U.jsx)(L,{pct:n.gradedTasks?n.passed/n.gradedTasks*100:0}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold`,children:`Definition of Done`}),(0,U.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[n.passed,` of `,n.gradedTasks,` graded tasks verified passed ·`,` `,n.totalTasks,` tasks total`]})]})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[(0,U.jsx)(Vt,{label:`verified`,value:n.passed,tone:`success`}),(0,U.jsx)(Vt,{label:`failed`,value:n.failed,tone:`destructive`}),(0,U.jsx)(Vt,{label:`needs human`,value:n.needsHuman,tone:`warning`}),(0,U.jsx)(Vt,{label:`incomplete`,value:n.incomplete,tone:`warning`}),(0,U.jsx)(Vt,{label:`unverified`,value:n.unverified,tone:`muted`})]}),(0,U.jsx)(Ht,{title:`Failing checks`,icon:ue,tone:`text-destructive`,onSelectTask:t,rows:n.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,U.jsx)(Ht,{title:`Evidence missing (agent/council checks without backing refs)`,icon:c,tone:`text-warning`,onSelectTask:t,rows:n.missingEvidence.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:t.description}))}),(0,U.jsx)(Ht,{title:`Needs decomposition`,icon:me,tone:`text-warning`,onSelectTask:t,rows:n.needsDecomposition.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`atomicity score ${e.atomicityAssessment?.score??`?`} — split before dispatch`}))}),(0,U.jsx)(Ht,{title:`Decomposition proposals awaiting approval`,icon:C,tone:`text-info`,onSelectTask:t,rows:n.pendingProposals.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`${e.decomposition?.proposedSubtasks.length??0} proposed subtasks`}))}),n.failingChecks.length===0&&n.missingEvidence.length===0&&n.needsDecomposition.length===0&&n.pendingProposals.length===0&&(0,U.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,U.jsx)(w,{size:14}),`No outstanding verification or decomposition issues on this board.`]})]})}var Wt={assigned:`bg-info/10 text-info`,queued:`bg-info/10 text-info`,running:`bg-warning/10 text-warning`,completed:`bg-success/10 text-success`,failed:`bg-destructive/10 text-destructive`,cancelled:`bg-muted text-muted-foreground`};function Gt(e,t){if(!e)return null;let n=Date.parse(e);if(Number.isNaN(n))return null;let r=t?Date.parse(t):Date.now();if(Number.isNaN(r))return null;let i=Math.max(0,Math.round((r-n)/1e3));if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${i%60}s`:`${Math.floor(a/60)}h ${a%60}m`}function Kt({assignment:e}){let t=e.status===`running`,n=Gt(e.dispatchedAt,e.completedAt),r=G(e.name)??G(e.agentId),i=G(e.role),a=G(e.provider),o=G(e.model),s=[];return r&&s.push({label:`Agent`,value:r}),i&&s.push({label:`Role`,value:i}),e.modelRouting&&s.push({label:`Model source`,value:e.modelRouting}),(a||o)&&s.push({label:`Model`,value:(0,U.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[a?`${a}/`:``,o??`—`]})}),e.subagentId&&s.push({label:`Subagent`,value:(0,U.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),n&&s.push({label:e.completedAt?`Duration`:`Elapsed`,value:n}),typeof e.attempt==`number`&&s.push({label:`Attempt`,value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&s.push({label:`Cost ceiling`,value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&s.push({label:`Fallback profile`,value:e.fallbackProfile}),e.fallbackModels?.length&&s.push({label:`Fallbacks`,value:e.fallbackModels.join(` → `)}),e.skills?.length&&s.push({label:`Skills`,value:e.skills.join(`, `)}),e.tools?.length&&s.push({label:`Tools`,value:e.tools.join(`, `)}),e.leaseExpiresAt&&s.push({label:`Lease expires`,value:new Date(e.leaseExpiresAt).toLocaleString()}),(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Live run`}),(0,U.jsxs)(`span`,{className:P(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,Wt[e.status]??`bg-muted text-muted-foreground`),children:[t&&(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),s.length>0&&(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:s.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,U.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Last result`}),(0,U.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,U.jsx)(`div`,{className:`mt-2 rounded border border-destructive/30 bg-destructive/10 px-2 py-1 text-[11px] text-destructive`,children:e.error})]})}function qt({activityKind:e,activityOutcome:t,note:n,details:r,onActivityKindChange:i,onActivityOutcomeChange:a,onNoteChange:o,onDetailsChange:s,onRecordActivity:c}){return(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Record decision / outcome`}),(0,U.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,U.jsx)(`select`,{value:e,onChange:e=>i(e.target.value),"aria-label":`Task activity kind`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`decision`,`attempt`,`result`,`blocker`,`observation`].map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))}),(0,U.jsx)(`select`,{value:t,onChange:e=>a(e.target.value),"aria-label":`Task activity outcome`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`unknown`,`succeeded`,`failed`,`partial`,`skipped`].map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(`input`,{value:n,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`What was decided, attempted, or produced?`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:c,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":`Record task decision or outcome`,children:(0,U.jsx)(M,{size:14})})]}),(0,U.jsx)(`input`,{value:r,onChange:e=>s(e.target.value),placeholder:`Optional evidence, rationale, command, link, or failure detail…`,"aria-label":`Task activity details`,className:`mt-1.5 h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`})]})}function Jt({board:e,task:t,newCheck:n,onNewCheckChange:r,onAddCheck:i,sendKanban:a}){return(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Completion checks`}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(t.successCriteria??[]).map(n=>(0,U.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,U.jsx)(b,{size:13,className:n.status===`passed`?`text-success`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:n.description}),(0,U.jsx)(`select`,{value:n.status,onChange:r=>a(`kanban.task.check.update`,{boardId:e?.id,taskId:t.id,checkId:n.id,status:r.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]},n.id)),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>e.key===`Enter`&&i(),placeholder:`Add a verifiable completion check…`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:i,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,U.jsx)(M,{size:14})})]})]})]})}var Yt=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Xt=[{value:`fs.read`,label:`Read files`,description:`fs.read`},{value:`fs.write`,label:`Write files (in project)`,description:`fs.write`},{value:`fs.write.outside-project`,label:`Write outside project`,description:`fs.write.outside-project`},{value:`net.outbound`,label:`Outbound network`,description:`net.outbound`},{value:`shell.exec`,label:`Run project commands`,description:`shell.exec`},{value:`shell.restricted`,label:`Restricted shell`,description:`shell.restricted`},{value:`shell.arbitrary`,label:`Arbitrary shell`,description:`shell.arbitrary`},{value:`session.todo`,label:`Session todos`,description:`session.todo`},{value:`tool.meta`,label:`Tool metadata`,description:`tool.meta`},{value:`tool.mutate.any`,label:`Invoke any tool`,description:`tool.mutate.any`},{value:`memory.read`,label:`Read memory`,description:`memory.read`},{value:`memory.write`,label:`Write memory`,description:`memory.write`},{value:`package.install`,label:`Install packages`,description:`package.install`},{value:`subagent.spawn`,label:`Spawn subagents`,description:`subagent.spawn`},{value:`config.mutate`,label:`Mutate config / trust`,description:`config.mutate`}];function Zt(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function J(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Qt(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?Y(J(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 $t(e){let t=J(e.before),n=J(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 en(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 tn(e){let t=J(e.before),n=J(e.after);if(e.type.startsWith(`task.file.`)){let e=Y(n.filePath),t=Y(n.toolName),r=typeof n.durationMs==`number`?n.durationMs:void 0,i=typeof n.lines==`number`?n.lines:void 0;return[e,t?`tool:${t}`:void 0,r===void 0?void 0:`${r}ms`,i===void 0?void 0:`${i} lines`].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.activity.`))return[Y(n.outcome),Y(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=Y(t.columnId),r=Y(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=$t(e);if(t.length)return`${t.length} field${t.length===1?``:`s`} changed: ${t.map(e=>e.field).join(`, `)}`}if(e.type===`task.lifecycle.transition`){let e=Y(t.stage),r=Y(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=Y(n.name)??Y(n.agentId)??Y(n.role),t=Y(n.provider),r=Y(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[Y(n.description),Y(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[Y(n.name),Y(n.status)].filter(Boolean).join(` · `)||void 0}function nn(e){let t=e.type;return Y(J(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 rn(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 an(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 on(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 sn({event:e}){let t=J(e.after),n=Y(t.provider),r=Y(t.model),i=Y(t.modelRouting),a=Y(t.fallbackProfile),o=Array.isArray(t.fallbackModels)?t.fallbackModels.filter(e=>typeof e==`string`):[],s=typeof t.attempt==`number`?t.attempt:void 0,c=typeof t.maxAttempts==`number`?t.maxAttempts:void 0,l=Y(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,U.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,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function cn({task:e,events:t,sessionId:n,loading:r=!1,error:i,onRefresh:a}){let[o,s]=(0,R.useState)(`all`),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),f=(0,R.useMemo)(()=>on(e,t,n),[e,t,n]),p=(0,R.useMemo)(()=>({all:f.length,execution:f.filter(e=>Qt(e)===`execution`).length,changes:f.filter(e=>Qt(e)===`changes`).length,notes:f.filter(e=>Qt(e)===`notes`).length,failures:f.filter(e=>Qt(e)===`failures`).length}),[f]),m=(0,R.useMemo)(()=>{let e=c.trim().toLowerCase();return f.filter(t=>o!==`all`&&Qt(t)!==o?!1:!e||[en(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))},[f,o,c]),g=we(m,50,`${o}:${c}`),_=g.pageItems,v=[...new Set(f.map(e=>e.actor).filter(Boolean))].length,y=[...new Set(f.map(e=>e.sessionId??n).filter(Boolean))].length;return(0,U.jsxs)(`section`,{"aria-label":`Task activity`,className:`mt-5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,U.jsx)(h,{className:`size-3.5 text-primary`}),(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Activity ledger`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground`,children:[m.length,`/`,f.length]}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(Zt(e,m,`filtered`),null,2)),d(!0)}catch{d(!1)}},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Copy visible task activity JSON`,title:`Copy filtered activity JSON`,children:u?(0,U.jsx)(b,{className:`size-3 text-success`}):(0,U.jsx)(_e,{className:`size-3`})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Zt(e,f,`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":`Download full task activity JSON`,title:`Download full activity JSON`,children:(0,U.jsx)(oe,{className:`size-3`})}),a&&(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Refresh task activity`,children:(0,U.jsx)(O,{className:P(`size-3`,r&&`animate-spin`)})})]})]}),(0,U.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`,f.length],[`Actors`,v],[`Sessions`,y],[`Failures`,p.failures]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,U.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(e),className:P(`rounded border px-1.5 py-1 text-[9px] capitalize`,o===e?`border-primary/50 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[e,` `,p[e]]},e))}),(0,U.jsxs)(`div`,{className:`relative mb-3`,children:[(0,U.jsx)(T,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,U.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),"aria-label":`Search task activity`,placeholder:`Search agent, session, model, result, field…`,className:`h-8 w-full rounded-md border bg-background pl-7 pr-7 text-[11px] outline-none focus:border-primary`}),c&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>l(``),"aria-label":`Clear task activity search`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(E,{className:`size-3`})})]}),i&&(0,U.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] text-destructive`,children:i}),m.length===0?(0,U.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-6 text-center text-[11px] text-muted-foreground`,children:`No activity matches this filter.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:_.map(e=>{let t=tn(e),r=e.sessionId??n,i=$t(e),a=Qt(e)===`failures`,o=e.type.includes(`completed`)||Y(J(e.after).outcome)===`succeeded`;return(0,U.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,U.jsx)(`span`,{className:P(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,nn(e))}),(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:en(e)}),(0,U.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,U.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:rn(e.ts)})]}),t&&(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,U.jsxs)(`div`,{className:P(`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,U.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,U.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,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,U.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,U.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`line-through opacity-70`,children:an(e.before)}),` `,(0,U.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,U.jsx)(`span`,{className:`text-foreground`,children:an(e.after)})]})]},e.field))}),(0,U.jsx)(sn,{event:e}),(e.actor||r||e.subagentId||e.runTaskId||e.correlationId)&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),r&&(0,U.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:r,children:[`session:`,r]}),e.subagentId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,U.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:`Full event payload`}),(0,U.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,U.jsx)(I,{page:g.page,pageSize:g.pageSize,totalItems:g.totalItems,onPageChange:g.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function ln(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function un(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 dn(e,t){return X(t.status)||(e.type===`task.claimed`?`claimed`:e.type===`task.released`?`released`:e.type===`task.stale_recovered`?`recovered`:e.type.split(`.`).at(-1)??`unknown`)}function fn(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function pn(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 mn(e,t,n){let r=on(e,t,n).filter(un).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=ln(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=dn(e,t),u=i.get(a)??{attempt:a,status:l,startedAt:e.ts,fallbackModels:[],sessionIds:new Set,eventCount:0};u.status=l,u.eventCount+=1,(e.sessionId??n)&&u.sessionIds.add(e.sessionId??n),u.owner=X(t.name)??X(t.agentId)??X(t.role)??e.actor??u.owner,u.provider=X(t.provider)??u.provider,u.model=X(t.model)??u.model,u.routingMode=X(t.modelRouting)??u.routingMode,u.fallbackProfile=X(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??X(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??X(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=X(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=X(t.error)??e.note??u.error),fn(l)&&(u.endedAt=e.ts),i.set(a,u),s=fn(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:pn(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function hn(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 gn(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 _n({task:e,events:t,sessionId:n}){let r=mn(e,t,n),i=we(r,8,e.id);return r.length?(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(ge,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Execution attempts`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[r.length,` total`]}),(0,U.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${gn(r[0].status)}`,children:[`latest:`,r[0].status]}),(0,U.jsx)(x,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[i.pageItems.map(e=>(0,U.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,U.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,U.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${gn(e.status)}`,children:e.status}),(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,U.jsx)(a,{className:`size-3`}),` `,hn(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,U.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(A,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,U.jsx)(j,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,U.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,U.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,U.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,U.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,U.jsx)(`strong`,{children:`Error:`}),` `,e.error]}),e.result&&(0,U.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,U.jsx)(`strong`,{children:`Result:`}),` `,e.result]})]},e.attempt)),(0,U.jsx)(I,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function vn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return G(e)}function yn(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 bn(e,t,n,r,i,a,o){let s=on(t,n,r),c=yn(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=vn(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Z(u?.modelRouting)??Z(f.modelRouting)??`session`,m=Z(u?.provider)??Z(f.provider)??(p===`session`?Z(i):void 0),h=Z(u?.model)??Z(f.model)??(p===`session`?Z(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Z).filter(e=>e!==void 0),_=Z(u?.fallbackProfile)??Z(f.fallbackProfile),v=Z(u?.name)??Z(u?.agentId)??Z(u?.role)??Z(t.assignee)??Z(t.assignedAgent)??`Unassigned`,y=t.lifecycle?.history.at(-1),b=s.find(e=>e.note&&e.type!==`task.note.added`)?.note,x=`Placed in ${e.columns.find(e=>e.id===t.columnId)?.title??t.columnId}.`;u?.error?x=`Agent run failed: ${u.error}`:l.length?x=`Blocked by ${l.map(e=>e.title).join(`, `)}.`:y?.comment?x=y.comment:b?x=b:t.status===`review`?x=`Implementation is waiting for review evidence or approval.`:t.status===`in_progress`?x=`${v} is currently working on this task.`:t.status===`completed`&&(x=`The task and its current assignment are complete.`);let S=s.map(e=>Number(vn(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,w=s.find(e=>Qt(e)===`failures`),T=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${Q(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??w?.note,lastResult:u?.lastResult??T?.note,eventCount:s.length,lastActivity:s[0]}}function Q(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function xn(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,U.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function Sn({icon:e,title:t,children:n}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,U.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,U.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function Cn({items:e}){return e.length?(0,U.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,U.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`None`})}function wn({board:e,task:t,events:n,presence:r,sessionId:i,sessionProvider:a,sessionModel:o}){let s=bn(e,t,n,i,a,o,r),c=t.assignment,l=t.successCriteria?.length??0,u=t.successCriteria?.filter(e=>e.status===`passed`).length??0,d=[t.parentTaskId,...t.childTaskIds??[],t.chain?.previousTaskId,t.chain?.nextTaskId,t.mergedIntoTaskId,...t.mergedFromTaskIds??[]].filter(e=>!!e),f=yn(e,[...new Set(d)]);return(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(de,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Task intelligence`}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:t.status}),(0,U.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:[s.eventCount,` events`]}),(0,U.jsx)(x,{className:`size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,U.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,U.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:s.column}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`stage:`,t.lifecycle?.currentStage??`legacy`]}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`priority:`,t.priority]}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`type:`,t.type??`inferred`]})]}),(0,U.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,U.jsx)(`strong`,{children:`Why here:`}),` `,s.reason]}),s.blockers.length>0&&(0,U.jsxs)(`p`,{className:`mt-1 text-[10px] text-warning`,children:[s.blockers.length,` unresolved blocker`,s.blockers.length===1?``:`s`]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,U.jsxs)(Sn,{icon:(0,U.jsx)(A,{className:`size-3`}),title:`Ownership & runtime`,children:[(0,U.jsx)($,{label:`Owner`,value:s.owner}),(0,U.jsx)($,{label:`Assignee`,value:Z(t.assignee)??Z(t.assignedAgent)??`—`}),(0,U.jsx)($,{label:`Agent ID`,value:Z(c?.agentId)??`—`,mono:!0}),(0,U.jsx)($,{label:`Agent name / role`,value:[Z(c?.name),Z(c?.role)].filter(Boolean).join(` · `)||`—`}),(0,U.jsx)($,{label:`Run status`,value:Z(c?.status)??`unassigned`}),(0,U.jsx)($,{label:`Subagent`,value:Z(c?.subagentId)??`—`,mono:!0}),(0,U.jsx)($,{label:`Run task`,value:Z(c?.runTaskId)??`—`,mono:!0}),(0,U.jsx)($,{label:`Session(s)`,value:s.sessions.join(`, `)||`Unknown`,mono:!0}),(0,U.jsx)($,{label:`Users / presence`,value:s.presence.length?s.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,U.jsxs)(Sn,{icon:(0,U.jsx)(j,{className:`size-3`}),title:`Model route & fallback`,children:[(0,U.jsx)($,{label:`Routing mode`,value:s.routingMode}),(0,U.jsx)($,{label:`Primary`,value:s.primaryModel,mono:!0}),(0,U.jsx)($,{label:`Provider`,value:s.provider??`—`,mono:!0}),(0,U.jsx)($,{label:`Model`,value:s.model??`—`,mono:!0}),(0,U.jsx)($,{label:`Fallback route`,value:s.fallbackRoute,mono:!0}),(0,U.jsx)($,{label:`Skills`,value:c?.skills?.map(Z).filter(Boolean).join(`, `)||`Default`}),(0,U.jsx)($,{label:`Tools`,value:c?.tools?.map(Z).filter(Boolean).join(`, `)||`Default toolset`}),(0,U.jsx)($,{label:`Capabilities`,value:c?.allowedCapabilities?.map(Z).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,U.jsxs)(Sn,{icon:(0,U.jsx)(w,{className:`size-3`}),title:`Execution policy & outcome`,children:[(0,U.jsx)($,{label:`Attempts`,value:`${s.attempts}${c?.maxAttempts?` / ${c.maxAttempts}`:``}`}),(0,U.jsx)($,{label:`Retry policy`,value:c?.retryPolicy??t.retryPolicy??`off`}),(0,U.jsx)($,{label:`Cost ceiling`,value:(c?.costCeilingUsd??t.costCeilingUsd)==null?`Unbounded`:`$${(c?.costCeilingUsd??t.costCeilingUsd).toFixed(2)}`}),(0,U.jsx)($,{label:`Failures / done`,value:`${s.failures} / ${s.completions}`}),(0,U.jsx)($,{label:`Checks`,value:`${u} / ${l} passed`}),(0,U.jsx)($,{label:`Last failure`,value:s.lastFailure??`—`}),(0,U.jsx)($,{label:`Result`,value:s.lastResult??`No result recorded`})]}),(0,U.jsxs)(Sn,{icon:(0,U.jsx)(h,{className:`size-3`}),title:`Timing & audit coverage`,children:[(0,U.jsx)($,{label:`Created`,value:Q(t.createdAt)}),(0,U.jsx)($,{label:`Updated`,value:Q(t.updatedAt)}),(0,U.jsx)($,{label:`Due`,value:Q(t.dueDate)}),(0,U.jsx)($,{label:`Dispatched`,value:Q(c?.dispatchedAt??c?.claimedAt)}),(0,U.jsx)($,{label:`Completed`,value:Q(c?.completedAt??t.completedAt)}),(0,U.jsx)($,{label:`Duration`,value:xn(c?.dispatchedAt??c?.claimedAt,c?.completedAt)}),(0,U.jsx)($,{label:`Heartbeat`,value:Q(c?.heartbeatAt)}),(0,U.jsx)($,{label:`Lease expires`,value:Q(c?.leaseExpiresAt)}),(0,U.jsx)($,{label:`Actors`,value:s.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,U.jsxs)(Sn,{icon:(0,U.jsx)(re,{className:`size-3`}),title:`Dependencies, chain & provenance`,children:[(0,U.jsx)($,{label:`Dependencies`,value:(0,U.jsx)(Cn,{items:s.dependencies})}),(0,U.jsx)($,{label:`Other relations`,value:(0,U.jsx)(Cn,{items:f})}),(0,U.jsx)($,{label:`Chain`,value:t.chain?`${t.chain.chainId} · position ${t.chain.order}`:`None`,mono:!0}),(0,U.jsx)($,{label:`Origin system`,value:t.origin?.system??`manual`}),(0,U.jsx)($,{label:`Origin IDs`,value:t.origin&&[t.origin.graphId,t.origin.phaseId,t.origin.taskId,t.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,U.jsx)($,{label:`Task ID`,value:t.id,mono:!0}),(0,U.jsx)($,{label:`Board ID`,value:e.id,mono:!0})]})]})]})}var Tn={passed:{icon:v,label:`Passed`,className:`text-success`},failed:{icon:o,label:`Failed`,className:`text-destructive`},needs_human:{icon:c,label:`Needs Review`,className:`text-warning`},incomplete:{icon:u,label:`Incomplete`,className:`text-muted-foreground`}},En={passed:{label:`Passed`,className:`text-success`},failed:{label:`Failed`,className:`text-destructive`},skipped:{label:`Skipped`,className:`text-muted-foreground`},error:{label:`Error`,className:`text-warning`}};function Dn(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 On({verdict:e}){let t=Tn[e],n=t.icon;return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-semibold ${t.className}`,children:[(0,U.jsx)(n,{size:13}),t.label]})}function kn({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,R.useState)(n);return(0,U.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,U.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,U.jsx)(x,{size:13}):(0,U.jsx)(ce,{size:13}),(0,U.jsx)(t,{size:13}),e]}),i&&(0,U.jsx)(`div`,{className:`border-t px-3 py-2 space-y-2`,children:r})]})}function An({check:e}){let t=En[e.status],[n,r]=(0,R.useState)(!1),i=e.error||e.backingRefs?.length;return(0,U.jsxs)(`div`,{className:`rounded border bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium ${t.className}`,children:t.label}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:e.type})]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:e.description})]}),i&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:n?(0,U.jsx)(x,{size:13}):(0,U.jsx)(ce,{size:13})})]}),n&&(0,U.jsxs)(`div`,{className:`mt-2 space-y-1.5 border-t pt-2`,children:[e.error&&(0,U.jsx)(`div`,{className:`rounded bg-destructive/10 px-2 py-1 text-destructive`,children:e.error}),e.backingRefs?.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,U.jsx)(fe,{size:11}),(0,U.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-[10px]`,children:[`(`,e.kind,`)`]}),e.summary&&(0,U.jsxs)(`span`,{className:`truncate`,children:[`— `,e.summary]})]},t))]})]})}function jn({fileScope:e}){return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Expected `,(0,U.jsx)(`strong`,{children:e.expectedChanges}),` changes`]}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Actual `,(0,U.jsx)(`strong`,{children:e.actualChanges}),` changes`]}),(0,U.jsx)(`span`,{className:e.scopeMatches?`text-success`:`text-destructive`,children:e.scopeMatches?`✅ Scope matches`:`❌ Scope mismatch`})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.files.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:e.operation===`create`?`text-success`:e.operation===`delete`?`text-destructive`:`text-muted-foreground`,children:e.operation===`create`?`+`:e.operation===`delete`?`−`:`∼`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-[10px]`,children:[e.linesChanged,` line`,e.linesChanged===1?``:`s`]}),!e.expected&&(0,U.jsx)(`span`,{className:`rounded bg-warning/10 px-1 text-[10px] text-warning`,children:`unexpected`})]},t))})]})}function Mn({subtasks:e}){return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{children:[`Total `,(0,U.jsx)(`strong`,{children:e.total})]}),(0,U.jsxs)(`span`,{className:`text-success`,children:[`Completed `,(0,U.jsx)(`strong`,{children:e.completed})]}),e.failed>0&&(0,U.jsxs)(`span`,{className:`text-destructive`,children:[`Failed `,(0,U.jsx)(`strong`,{children:e.failed})]})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.children.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.verdict===`passed`?(0,U.jsx)(`span`,{className:`text-success`,children:`✓`}):e.verdict===`failed`?(0,U.jsx)(`span`,{className:`text-destructive`,children:`✗`}):e.verdict===`needs_human`?(0,U.jsx)(`span`,{className:`text-warning`,children:`⚠`}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`○`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},t))})]})}function Nn({attachments:e}){return(0,U.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded border bg-muted/30 px-2 py-1.5 text-xs`,children:[(0,U.jsx)(le,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,U.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.path?(0,U.jsxs)(`span`,{className:`truncate block`,children:[e.path,(0,U.jsx)(`span`,{className:`ml-1 rounded bg-muted px-1 text-[10px]`,children:e.kind})]}):(0,U.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px]`,children:e.kind})}),e.content&&(0,U.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 Pn({report:e}){return(0,U.jsxs)(`div`,{className:`mt-5 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Verification Report`}),(0,U.jsx)(On,{verdict:e.verdict})]}),e.markdownSummary&&(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:Dn(e.startedAt,e.completedAt)})]}),e.markdownSummary&&(0,U.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,U.jsx)(kn,{title:`Check Results`,icon:pe,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,U.jsx)(An,{check:e},e.checkId))}),e.fileScope&&(0,U.jsx)(kn,{title:`File Scope`,icon:fe,defaultOpen:!e.fileScope.scopeMatches,children:(0,U.jsx)(jn,{fileScope:e.fileScope})}),e.subtasks&&(0,U.jsx)(kn,{title:`Sub-Tasks`,icon:pe,children:(0,U.jsx)(Mn,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,U.jsx)(kn,{title:`Attachments (${e.attachments.length})`,icon:le,children:(0,U.jsx)(Nn,{attachments:e.attachments})})]})}function Fn({boardId:e,task:t,sendKanban:n}){return vt(t,xe(n=>n.verificationActivity[`${e}:${t.id}`]))===`running`?(0,U.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,U.jsx)(ae,{size:14,className:`animate-spin`}),`Verification running — checks are being executed…`]}):t.verificationReport?(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(Pn,{report:t.verificationReport}),(0,U.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:`Re-run verification`})]}):(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border border-dashed p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(C,{size:14}),(0,U.jsx)(`span`,{className:`font-medium`,children:`Unverified`}),(0,U.jsx)(`span`,{children:`— no verification report exists for this task yet.`})]}),(0,U.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:`Run verification`})]})}function In({boards:e,board:t,task:n,runLink:r,onClose:i,onSelectTask:a,sendKanban:o,sendRaw:s,refreshBoard:c,activityEvents:l,activityPresence:u,activityLoading:f,activityError:p,activitySessionId:h,refreshActivity:g}){let[v,y]=(0,R.useState)(``),[b,C]=(0,R.useState)(``),[T,D]=(0,R.useState)(``),[O,te]=(0,R.useState)(``),[re,ie]=(0,R.useState)(``),[k,ae]=(0,R.useState)(`session`),[A,oe]=(0,R.useState)(``),[se,ce]=(0,R.useState)([]),[le,ue]=(0,R.useState)([]),[de,fe]=(0,R.useState)([]),[pe,me]=(0,R.useState)([]),[j,he]=(0,R.useState)(``),ge=Se(!!n),M=qe(!!n),N=G(M.sessionProvider),ve=G(M.sessionModel),ye=Te(`kanban-task-inspector`,!!n),[be,xe]=(0,R.useState)(!1),[F,we]=(0,R.useState)(!1),[I,Ee]=(0,R.useState)(``),[L,De]=(0,R.useState)(``),[z,Oe]=(0,R.useState)(``),[ke,Ae]=(0,R.useState)(`pending`),[je,Me]=(0,R.useState)(``),[Ne,Pe]=(0,R.useState)(``),[Fe,Ie]=(0,R.useState)(``),[Le,Re]=(0,R.useState)(`medium`),[ze,Be]=(0,R.useState)(`chore`),[B,Ve]=(0,R.useState)(``),[V,He]=(0,R.useState)([]),[Ue,We]=(0,R.useState)([]),[H,Ge]=(0,R.useState)(!1),[Ke,Je]=(0,R.useState)(``),[Ye,Xe]=(0,R.useState)(``),[Ze,Qe]=(0,R.useState)(`off`),[$e,et]=(0,R.useState)(``),[tt,nt]=(0,R.useState)(``),[rt,it]=(0,R.useState)(``),[at,ot]=(0,R.useState)(``),[ct,lt]=(0,R.useState)(``),[ut,dt]=(0,R.useState)(`observation`),[ft,pt]=(0,R.useState)(`unknown`),[mt,ht]=(0,R.useState)(``);(0,R.useEffect)(()=>{let r=G(n?.assignment?.provider),i=G(n?.assignment?.model);y(G(n?.assignment?.agentId)??G(n?.assignedAgent)??``),C(G(n?.assignment?.name)??``),D(G(n?.assignment?.role)??``),te(r??``),ie(i??``),ae(n?.assignment?.modelRouting??(r||i?`fixed`:`session`)),oe(G(n?.assignment?.fallbackProfile)??``),ce(n?.assignment?.fallbackModels??[]),ue(n?.assignment?.skills??[]),fe(n?.assignment?.tools??[]),me(n?.assignment?.allowedCapabilities??[]),he(e.find(e=>e.id!==t?.id)?.id??``),Ee(n?.title??``),De(n?.description??``),Oe(n?.dueDate??``),Ae(n?.status??`pending`),Me(``),Pe(``),Ie(``),Re(n?.priority??`medium`),Be(n?.type??`chore`),Ve(n?.labels?.join(`, `)??``),He(n?.dependsOn??[]),We(n?.chain&&t?t.tasks.filter(e=>e.chain?.chainId===n.chain?.chainId).sort((e,t)=>(e.chain?.order??0)-(t.chain?.order??0)).map(e=>e.id):n?[n.id]:[]),Ge(!1),Je(n?.estimatedHours?.toString()??``),Xe(n?.actualHours?.toString()??``),Qe(n?.retryPolicy??n?.assignment?.retryPolicy??`off`),et((n?.costCeilingUsd??n?.assignment?.costCeilingUsd)?.toString()??``),nt(n?.assignment?.maxAttempts?.toString()??``),it(``),ot(``),lt(``),dt(`observation`),pt(`unknown`),ht(``)},[t?.id,e,n]);let _t=e=>({boardId:t?.id,taskId:n?.id,...v.trim()?{agentId:v.trim()}:{},...b.trim()?{name:b.trim()}:{},...T.trim()?{role:T.trim()}:{},modelRouting:k,...k===`fixed`&&O.trim()?{provider:O.trim()}:{},...k===`fixed`&&re.trim()?{model:re.trim()}:{},...k===`fallback_profile`&&A.trim()?{fallbackProfile:A.trim()}:{},fallbackModels:se,skills:le,tools:de,allowedCapabilities:pe,...tt?{maxAttempts:Number(tt)}:{},...$e?{costCeilingUsd:Number($e)}:{},retryPolicy:Ze,activityNote:mt.trim()||`${e===`dispatch`?`Dispatched`:`Assigned`} from WebUI to ${b.trim()||v.trim()||T.trim()||`the configured agent route`}.`}),vt=()=>{!t||!n||!I.trim()||(o(`kanban.task.update`,{boardId:t.id,taskId:n.id,title:I.trim(),description:L,dueDate:z||null,...t.lifecycle?.mode===`managed`?{}:{status:ke},priority:Le,type:ze,labels:B.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:V,...n.chain&&Ue.length<=1?{chain:null}:{},estimatedHours:Ke?Number(Ke):0,actualHours:Ye?Number(Ye):0,retryPolicy:Ze,costCeilingUsd:$e?Number($e):null,activityNote:mt.trim()||`Task contract edited in WebUI.`}),Ue.length>1&&o(`kanban.task.chain`,{boardId:t.id,taskIds:Ue,enforceDependencies:H}),window.setTimeout(()=>c(t.id),180),ht(``))},yt=[`backlog`,`todo`,`running`,`review`,`done`],bt=n?.lifecycle?.currentStage,xt=bt?yt.indexOf(bt):-1,St=xt>=0&&xt<yt.length-1?yt[xt+1]:void 0;return n?(0,U.jsxs)(`aside`,{"aria-label":`Task inspector`,"data-expanded":F?`true`:`false`,className:P(`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`,F?`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,U.jsxs)(`div`,{className:P(`flex h-12 items-center gap-2 border-b px-3`,F&&`px-5`),children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Task`}),(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:n.id.slice(0,8)})]}),(0,U.jsx)(`button`,{type:`button`,title:F?`Collapse task details`:`Expand task details`,"aria-label":F?`Collapse task details`:`Expand task details`,"aria-pressed":F,onClick:()=>we(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:F?(0,U.jsx)(_,{size:16}):(0,U.jsx)(S,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Close`,onClick:()=>{we(!1),i()},className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(E,{size:16})})]}),n?(0,U.jsxs)(`div`,{ref:ye,className:P(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,F&&`px-5 py-4 xl:px-7`),children:[(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,U.jsx)(st,{title:`Task boundary`,value:n.boundary,inherited:t?.boundary,onSave:e=>{t&&(o(`kanban.task.update`,{boardId:t.id,taskId:n.id,boundary:e,activityNote:`Task boundary edited in WebUI.`}),window.setTimeout(()=>c(t.id),150))}}),(0,U.jsx)(K,{label:`Title`,value:I,onChange:Ee}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Description / working context`}),(0,U.jsx)(`textarea`,{value:L,onChange:e=>De(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,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,U.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Managed stage`}),(0,U.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:n.lifecycle?.currentStage??`Backlog`})]}):(0,U.jsx)(q,{label:`Status`,value:ke,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>Ae(e)}),(0,U.jsx)(q,{label:`Priority`,value:Le,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Re(e)}),(0,U.jsx)(q,{label:`Type`,value:ze,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>Be(e)}),(0,U.jsx)(K,{label:`Labels (comma separated)`,value:B,onChange:Ve})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)(K,{label:`Due date (ISO or YYYY-MM-DD)`,value:z,onChange:Oe}),(0,U.jsx)(K,{label:`Estimated hours`,value:Ke,onChange:Je}),(0,U.jsx)(K,{label:`Actual hours`,value:Ye,onChange:Xe})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Dependencies`}),(0,U.jsx)(W,{options:(t?.tasks??[]).filter(e=>e.id!==n.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:V,onChange:He,placeholder:`Select blocking tasks…`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Task chain (selection order)`}),(0,U.jsx)(W,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:Ue,onChange:e=>We(e.includes(n.id)?e:[n.id,...e]),placeholder:`Add tasks to a sequential chain…`}),(0,U.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>Ge(e.target.checked)}),`Enforce chain order as dependencies`]})]}),(0,U.jsx)(K,{label:`Change / assignment reason (persisted to activity)`,value:mt,onChange:ht}),(0,U.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,U.jsx)(ee,{size:15}),` Save task contract`]}),t?.lifecycle?.mode===`managed`&&St&&(0,U.jsxs)(`section`,{"aria-label":`Managed lifecycle transition`,className:`space-y-2 rounded-md border border-primary/30 bg-primary/5 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Kanban Agent transition`}),(0,U.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[bt,` → `,St,`; no stages can be skipped.`]})]}),(0,U.jsx)(w,{size:16,className:`text-primary`})]}),(0,U.jsx)(K,{label:`Completed action / reviewer action`,value:Ne,onChange:Pe}),(0,U.jsx)(K,{label:`Truthful progress comment (required)`,value:je,onChange:Me}),(0,U.jsx)(K,{label:`Evidence attachment URL`,value:Fe,onChange:Ie}),(0,U.jsxs)(`button`,{type:`button`,disabled:!je.trim(),onClick:()=>{!t||!n||!St||!je.trim()||(o(`kanban.task.transition`,{boardId:t.id,taskId:n.id,to:St,actor:v.trim()||b.trim()||n.assignee||n.assignedAgent||`webui-agent`,comment:je.trim(),...Ne.trim()?{action:Ne.trim()}:{},...Fe.trim()?{attachment:{url:Fe.trim(),type:`url`,title:`Evidence for ${n.title}`}}:{}}),window.setTimeout(()=>c(t.id),180))},className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,U.jsx)(d,{size:15}),` Advance to `,St]})]})]}),t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wn,{board:t,task:n,events:l,presence:u,sessionId:h,sessionProvider:N,sessionModel:ve}),(0,U.jsx)(_n,{task:n,events:l,sessionId:h}),(0,U.jsx)(jt,{board:t,task:n,events:l})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,U.jsx)(wt,{label:`Source`,value:n.origin?.system??`manual`}),(0,U.jsx)(wt,{label:`Task ID`,value:n.id.slice(0,8)}),(0,U.jsx)(wt,{label:`Run`,value:n.assignment?.status??`unassigned`}),(0,U.jsx)(wt,{label:`Column`,value:Ct(t,n.columnId)})]}),n.assignment&&(0,U.jsx)(Kt,{assignment:n.assignment}),r&&n.origin?.taskId&&(0,U.jsx)(Lt,{runLink:r,runTaskId:n.origin.taskId,modelCandidates:ge,sendRaw:s}),!r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(q,{label:`Primary model source`,value:k,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>ae(e)}),k===`session`&&(0,U.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: `,N?`${N}/`:``,ve||`not available`,`.`]}),k===`fixed`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,U.jsx)(Ce,{value:re||void 0,provider:O||void 0,candidates:ge,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{ie(e),te(t)}})]}),k===`fallback_profile`&&(0,U.jsx)(q,{label:`Fallback profile (first model is primary)`,value:A,options:Object.keys(M.fallbackProfiles),placeholder:`Select configured profile…`,onChange:oe}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fallback models`}),(0,U.jsx)(W,{options:ge.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:se,onChange:ce,placeholder:`Add fallback model…`,emptyLabel:`No models — add a provider in Settings`})]}),(0,U.jsx)(q,{label:`Role`,value:T,options:Yt,placeholder:`Select a role…`,onChange:D}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· force-loaded into the worker`})]}),(0,U.jsx)(W,{options:M.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:le,onChange:ue,placeholder:`Assign required skills…`,emptyLabel:`No skills registered`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = full default toolset`})]}),(0,U.jsx)(W,{options:M.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:de,onChange:fe,placeholder:`Restrict to specific tools…`,emptyLabel:`Tool list unavailable on this server`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,U.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:[`Advanced`,(0,U.jsx)(x,{size:13,className:P(`transition-transform`,be&&`rotate-180`)})]}),be&&(0,U.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,U.jsx)(K,{label:`Agent name (optional)`,value:b,onChange:C}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)(q,{label:`Retry policy`,value:Ze,options:[`off`,`incremental`,`exponential`],onChange:e=>Qe(e)}),(0,U.jsx)(K,{label:`Max attempts`,value:tt,onChange:nt}),(0,U.jsx)(K,{label:`Cost ceiling USD`,value:$e,onChange:et})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = safe defaults`})]}),(0,U.jsx)(W,{options:Xt,selected:pe,onChange:me,placeholder:`Grant a capability…`})]})]})]})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(o(`kanban.task.assign`,_t(`assign`)),ht(``),window.setTimeout(()=>c(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,U.jsx)(m,{size:15}),`Assign`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(o(`kanban.task.dispatch`,_t(`dispatch`)),ht(``),window.setTimeout(()=>c(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,U.jsx)(ne,{size:15}),`Dispatch`]})]})]}),e.length>1&&!r?(0,U.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Target board`}),(0,U.jsx)(`select`,{value:j,onChange:e=>he(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,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!j||o(`kanban.task.copy`,{boardId:t.id,taskId:n.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,U.jsx)(_e,{size:15}),`Copy`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!j||o(`kanban.task.transfer`,{boardId:t.id,taskId:n.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,U.jsx)(d,{size:15}),`Transfer`]})]})]}):null,(0,U.jsx)(Jt,{board:t,task:n,newCheck:rt,onNewCheckChange:it,onAddCheck:()=>{!t||!n||!rt.trim()||(o(`kanban.task.check.add`,{boardId:t.id,taskId:n.id,description:rt.trim(),checkType:`manual`}),it(``))},sendKanban:o}),t&&(0,U.jsx)(Fn,{boardId:t.id,task:n,sendKanban:o}),t&&(0,U.jsx)(gt,{board:t,task:n,sendKanban:o,onSelectTask:a}),(0,U.jsx)(cn,{task:n,events:l,sessionId:h,loading:f,error:p,onRefresh:g}),(0,U.jsx)(qt,{activityKind:ut,activityOutcome:ft,note:at,details:ct,onActivityKindChange:dt,onActivityOutcomeChange:pt,onNoteChange:ot,onDetailsChange:lt,onRecordActivity:()=>{!t||!n||!at.trim()||(o(`kanban.task.activity.add`,{boardId:t.id,taskId:n.id,kind:ut,outcome:ft,summary:at.trim(),...ct.trim()?{details:ct.trim()}:{},actor:b.trim()||v.trim()||`webui-operator`}),ot(``),lt(``),window.setTimeout(g,150))}})]}):null]}):null}var Ln=[[`board`,`Board`],[`tree`,`Tree`],[`dashboard`,`Verification`]];function Rn({viewMode:e,onViewModeChange:t}){return(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-4 py-1.5`,children:Ln.map(([n,r])=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:P(`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 zn(){let[e,t]=(0,R.useState)([]);return(0,R.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 Bn=5e3,Vn=12;function Hn({onClose:e}){let t=be(e=>e.wsUrl),n=ye(e=>e.session?.id??null),r=F(e=>e.agents),{boards:i,boardTotal:a,activeBoardTotal:o,orphanedBoardTotal:s,activeBoardId:c,activeBoard:l,loading:u,error:d,queueHealth:p,supervisorSnapshot:m,setLoading:h,setActiveBoardId:g}=xe(),[_,v]=(0,R.useState)(``),[y,b]=(0,R.useState)(1),x=zn(),[S,C]=(0,R.useState)(``),w=(0,R.useRef)(null);De(w);let[T,ee]=(0,R.useState)(``),[D,O]=(0,R.useState)(null),[te,ne]=(0,R.useState)([]),[re,k]=(0,R.useState)(),[ae,A]=(0,R.useState)(!1),[oe,se]=(0,R.useState)(null),[ce,le]=(0,R.useState)(0),[ue,de]=(0,R.useState)(null),[fe,pe]=(0,R.useState)(`board`),me=(0,R.useRef)(null),j=(0,R.useMemo)(()=>ve(t),[t]),he=l?.tasks.find(e=>e.id===D)??null,ge=(0,R.useMemo)(()=>$e(r.values()),[r]),N=(0,R.useMemo)(()=>et({sessionId:n,registrySessionIds:x,agents:r.values()}),[r,x,n]),P=i.filter(e=>tt(e,N)),Se=i.filter(e=>!tt(e,N)),Ce=(0,R.useMemo)(()=>l?ke(l,{now:Date.now(),liveAgentIdentities:ge,requireDueDate:l.lifecycle?.mode===`managed`}):null,[l,ge]),we=(0,R.useMemo)(()=>nt(l),[l]),I=(e,t={})=>{h(!0),j.send({type:e,payload:t})},Te=(e,t={})=>{j.send({type:e,payload:t})},Ee=(0,R.useMemo)(()=>rt(l),[l]),L=(e=y)=>I(`kanban.list`,{page:e,pageSize:Vn,activeSessionIds:N}),z=(e=c)=>{e&&I(`kanban.get`,{boardId:e})};(0,R.useEffect)(()=>{L()},[]),(0,R.useEffect)(()=>{let e=n?i.find(e=>e.tags?.includes(`session:${n}`)):void 0,t=!!(n&&e)&&me.current!==n,r=t?e:c?void 0:i[0];r?.id&&(t&&(me.current=n),g(r.id),I(`kanban.get`,{boardId:r.id}))},[i,c,n,g]),(0,R.useEffect)(()=>{l&&D&&!l.tasks.some(e=>e.id===D)&&O(null)},[l,D]),(0,R.useEffect)(()=>{c&&(I(`kanban.health`,{boardId:c}),I(`kanban.supervisor.status`,{boardId:c}))},[c]),(0,R.useEffect)(()=>{if(!c)return;let e=setInterval(()=>{j.send({type:`kanban.get`,payload:{boardId:c}}),j.send({type:`kanban.health`,payload:{boardId:c}})},5e3);return()=>clearInterval(e)},[c,j]),(0,R.useEffect)(()=>{let e=setInterval(()=>{j.send({type:`kanban.list`,payload:{page:y,pageSize:Vn,activeSessionIds:N}})},8e3);return()=>clearInterval(e)},[N,y,j]);let Oe=e=>{b(e),g(null),L(e)};(0,R.useEffect)(()=>{k(void 0)},[c,D]),(0,R.useEffect)(()=>{if(!c||!D)return;let e=c,t=D;A(!0),se(null);let n=j.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){se(r.error??`Task activity could not be loaded.`),A(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(ne(r.data.events??[]),k(r.data.presence??[]),A(!1))});return j.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Bn}}),n},[c,D,he?.updatedAt,ce,j]),(0,R.useEffect)(()=>{if(!(!c||!D))return j.on.bind(j)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===c&&t.taskId===D&&le(e=>e+1)})},[c,D,j]);let Ae=()=>{let e=_.trim();e&&(v(``),I(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},je=()=>{if(!l)return;let e=S.trim();e&&(C(``),I(`kanban.task.add`,{boardId:l.id,title:e,columnId:l.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>z(l.id),150))},Me=()=>{if(!l)return;let e=T.trim();e&&(ee(``),I(`kanban.column.add`,{boardId:l.id,title:e}),window.setTimeout(()=>z(l.id),150))},Ne=()=>{l&&(I(`kanban.delete`,{boardId:l.id}),window.setTimeout(L,150))},Pe=()=>{l&&(I(`kanban.duplicate`,{boardId:l.id,title:`${l.title} Copy`}),window.setTimeout(L,150))},Fe=e=>{l&&(I(`kanban.task.remove`,{boardId:l.id,taskId:e.id}),window.setTimeout(()=>z(l.id),150))},Ie=(e,t)=>{if(!l)return;let n=l.tasks.find(t=>t.id===e),r=l.columns.find(e=>e.id===n?.columnId)?.title,i=l.columns.find(e=>e.id===t)?.title??t;I(`kanban.task.move`,{boardId:l.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>z(l.id),150)};return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,U.jsx)(it,{boardTotal:a,activeBoardTotal:o,orphanedBoardTotal:s,activeBoardId:c,activeBoards:P,orphanedBoards:Se,boardPage:y,boardPageSize:Vn,loading:u,newBoardTitle:_,onClose:e,onRefresh:()=>L(),onNewBoardTitleChange:v,onCreateBoard:Ae,onBoardSelect:e=>{g(e),I(`kanban.get`,{boardId:e})},onBoardPageChange:Oe}),(0,U.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.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,U.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:l?.title??`No board selected`}),(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:l?`${l.columns.length} columns / ${l.tasks.length} tasks`:`Create or select a board`})]}),l&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&je()},placeholder:`New task`,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,U.jsx)(`button`,{type:`button`,title:`Add task`,onClick:je,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,U.jsx)(M,{size:16})}),(0,U.jsx)(`input`,{value:T,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Me()},placeholder:`New column`,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,U.jsx)(`button`,{type:`button`,title:`Add column`,onClick:Me,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex`,children:(0,U.jsx)(f,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Duplicate board`,onClick:Pe,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(_e,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Delete board`,onClick:Ne,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive sm:flex`,children:(0,U.jsx)(ie,{size:16})})]})]}),l&&(0,U.jsx)(Xe,{presence:l.presence}),l&&(0,U.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,U.jsx)(st,{title:`Board boundary`,value:l.boundary,onSave:e=>{I(`kanban.update`,{boardId:l.id,boundary:e}),window.setTimeout(()=>z(l.id),150)}})}),l&&Ee&&(0,U.jsx)(Ft,{runLink:Ee,sendRaw:Te}),l&&!Ee&&l.tasks.length>0&&(0,U.jsx)(It,{boardId:l.id,sendKanban:I}),l&&(0,U.jsx)(Ze,{board:l,snapshot:m,sendKanban:I}),Ce&&(0,U.jsx)(dt,{audit:Ce,onSelectTask:O}),l&&(0,U.jsx)(pt,{board:l,sendKanban:I,onSelectTask:O}),l&&(0,U.jsx)(Rn,{viewMode:fe,onViewModeChange:pe}),d&&(0,U.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,U.jsx)(E,{size:15}),(0,U.jsx)(`span`,{className:`truncate`,children:d})]}),(0,U.jsx)(`div`,{ref:w,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:l?(0,U.jsxs)(U.Fragment,{children:[p&&(0,U.jsx)(Pt,{queueHealth:p,runningCostTotal:we}),fe===`tree`?(0,U.jsx)(Bt,{board:l,selectedTaskId:D,onSelectTask:O}):fe===`dashboard`?(0,U.jsx)(Ut,{board:l,onSelectTask:O}):(0,U.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...l.columns].sort((e,t)=>e.order-t.order).map(e=>(0,U.jsx)(Nt,{board:l,column:e,selectedTaskId:D,dragTaskId:ue,setDragTaskId:de,onSelectTask:O,onDeleteTask:Fe,onMoveTask:Ie},e.id))})]}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No kanban board selected.`})})]}),(0,U.jsx)(In,{boards:i,board:l,task:he,runLink:Ee,onClose:()=>O(null),onSelectTask:O,sendKanban:I,sendRaw:Te,refreshBoard:z,activityEvents:te,activityPresence:re,activityLoading:ae,activityError:oe,activitySessionId:l?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>le(e=>e+1)})]})}export{Hn as KanbanView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Di as t,Ft as n,Gn as r,Ia as i,Ii as a,Mi as o,Or as s,Pa as c,Vi as l,Xn as u,an as d,dn as f,dt as p,er as m,hn as h,in as g,ja as _,lt as v,qr as y,ua as b,va as x,xt as S}from"./vendor-CxV3l5PQ.js";import"./i18n-DxnYsmc-.js";import{n as C}from"./ui-store-C4Ybfoon.js";import{t as w}from"./utils-_s0GyctV.js";import{t as T}from"./mailbox-store-xh2Ux-Xs.js";import{o as E}from"./view-navigation-DLdE7qHU.js";import{g as D,u as O}from"./index-Bf75VrDE.js";import{t as k}from"./empty-state-02bIS4x7.js";var A=e(i(),1),j=v(),M={note:y,ask:a,assign:g,steer:f,btw:b,broadcast:g,status:o,result:l,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?c.t(`common:time.justNow`):n<36e5?c.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?c.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?c.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t}=_(),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)(l,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:i}=_(),a=C(e=>e.selectedMailMessage),o=C(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{o(null)},[o]);function c(){o(null),E(`chat`)}if(!a)return(0,j.jsx)(k,{icon:(0,j.jsx)(u,{className:`h-6 w-6`}),title:i(`activity:mailbox.emptyDetail`),description:i(`activity:mailbox.emptyDetailHint`)});let d=M[a.type]??r,f=i(`activity:mailbox.type.${a.type}`,{defaultValue:a.type}),g=N[a.priority]??N.normal,v=a.scope?{scope:a.scope,recipientSessionId:a.recipientSessionId}:T(a.to),y=a.to===`*`||a.to===`all`?i(`activity:mailbox.everyone`):a.to,b=v.scope===`session`?i(`activity:mailbox.sessionScope`,{sid:v.recipientSessionId??``}):v.scope===`project`?i(`activity:mailbox.projectScope`):i(`activity:mailbox.directScope`);return(0,j.jsx)(`div`,{className:w(`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:c,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:i(`activity:mailbox.backToChat`),children:(0,j.jsx)(x,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className:w(`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)(d,{className:w(`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)(l,{className:`h-3 w-3`}),i(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:w(`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)(m,{className:`h-2.5 w-2.5`}),` `,i(`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:y}),v.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:i(`activity:mailbox.sessionScopeTitle`,{sid:v.recipientSessionId??``}),children:[(0,j.jsx)(m,{className:`h-2.5 w-2.5`}),i(`activity:mailbox.sessionLabel`)]}),v.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)(s,{className:`h-2.5 w-2.5`}),i(`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:c,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:i(`activity:mailbox.closeTitle`),children:(0,j.jsx)(p,{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)(n,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:f})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:w(`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)(S,{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:[v.scope===`session`?(0,j.jsx)(m,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(s,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:i(`activity:mailbox.scopeLabel`)}),(0,j.jsx)(`span`,{className:`truncate`,children:b})]}),(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)(h,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:i(`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)(l,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:a.completedAt?i(`activity:mailbox.completedByAt`,{name:a.completedBy,time:P(a.completedAt)}):i(`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:i(`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:i(`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};
|