@wrongstack/webui 0.293.0 → 0.295.1
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/App.d.ts.map +1 -1
- package/dist/assets/AgentRosterView-C7u9H5Jp.js +11 -0
- package/dist/assets/AnalyticsDashboard-CZ8KAg7h.js +1 -0
- package/dist/assets/AudienceMemoryPanel-N6ErXDAb.js +3 -0
- package/dist/assets/ChangesView-fVxtWQ07.js +1 -0
- package/dist/assets/ChronicleDashboard-C-NQsArq.js +1 -0
- package/dist/assets/CodeEditor-B9k1HwTM.js +1 -0
- package/dist/assets/CodeMap-CZ7wFa8f.js +1 -0
- package/dist/assets/ConfirmModal-BvW6_eIc.js +1 -0
- package/dist/assets/{CronJobsPanel-ByJqIjCv.js → CronJobsPanel-C4zvyecc.js} +1 -1
- package/dist/assets/{DebugDashboard-B0pikasm.js → DebugDashboard-Z7ZFkSFX.js} +1 -1
- package/dist/assets/DesignGalleryView-DIsg05FX.js +1 -0
- package/dist/assets/{GoalView-DXO9txQs.js → GoalView-pBKJcLBt.js} +1 -1
- package/dist/assets/KanbanView-qzKvGeMx.js +3 -0
- package/dist/assets/{LazyMarkdown-BHoUIDge.js → LazyMarkdown-Cpjlf6IL.js} +3 -3
- package/dist/assets/MailboxDetailView-BKxA4wf_.js +1 -0
- package/dist/assets/MemoryManager-DO_Z8Scl.js +1 -0
- package/dist/assets/{ModelPicker-CEZN673P.js → ModelPicker-DOXb0iz4.js} +1 -1
- package/dist/assets/{OfficeMapPanel-B0j4e2O1.css → OfficeMapPanel-BFIF-EMt.css} +1 -1
- package/dist/assets/OfficeMapPanel-BVDeIWuD.js +4 -0
- package/dist/assets/ProcessMonitor-Ci000o1n.js +1 -0
- package/dist/assets/{QueuePanel-DMXksqFS.js → QueuePanel-63vvbJOy.js} +1 -1
- package/dist/assets/{RefreshDebugView-D08bCHA4.js → RefreshDebugView-8Sivo34V.js} +1 -1
- package/dist/assets/SddHub-DW97GpcS.js +2 -0
- package/dist/assets/{SessionsDashboard-BY77vax1.js → SessionsDashboard-DhNaepDJ.js} +1 -1
- package/dist/assets/SetupScreen-BewutFxF.js +1 -0
- package/dist/assets/SkillDetailView-d39kknmg.js +3 -0
- package/dist/assets/{SpecsView-CZg7e2ml.js → SpecsView-BOp0sUME.js} +1 -1
- package/dist/assets/TechStackView-DfFfTJVR.js +1 -0
- package/dist/assets/{TerminalPanel-SnRvUh6N.js → TerminalPanel-663hC2Jc.js} +1 -1
- package/dist/assets/{Toaster-BNdKxZ1U.js → Toaster-YMBi0Ssd.js} +1 -1
- package/dist/assets/activity-3HtRx2SK.js +5 -0
- package/dist/assets/activity-BGlYr63p.js +5 -0
- package/dist/assets/activity-BolwRvqr.js +5 -0
- package/dist/assets/activity-C8BMSvRx.js +5 -0
- package/dist/assets/{activity-Dyikq8Zm.js → activity-CM8z-okz.js} +4 -4
- package/dist/assets/activity-HfL12UVp.js +5 -0
- package/dist/assets/activity-Xd77MZv_.js +5 -0
- package/dist/assets/{button-Dy0bAtEY.js → button-5TIs9T5p.js} +1 -1
- package/dist/assets/{chat-store-CUODHW6c.js → chat-store-fBghgjNK.js} +7 -7
- package/dist/assets/{codemap-activity-store-CgtLR4PV.js → codemap-activity-store-C5DyqUoZ.js} +1 -1
- package/dist/assets/codemap-index-store-p2tz1Laz.js +1 -0
- package/dist/assets/{dialog-CBgO-uqz.js → dialog-BkCs93Vo.js} +1 -1
- package/dist/assets/empty-state-DrJ4uVh8.js +1 -0
- package/dist/assets/{i18n-Dk35g-uV.js → i18n-Cjk0Ya0G.js} +2 -2
- package/dist/assets/index-D0zt9ziw.css +1 -0
- package/dist/assets/index-HYvJnpTs.js +126 -0
- package/dist/assets/{input-B6FY_vtB.js → input-dEFwkTqb.js} +1 -1
- package/dist/assets/{mailbox-store-BY2SVw-s.js → mailbox-store-DC7x_eml.js} +1 -1
- package/dist/assets/progress-ring-CGN0o9DE.js +1 -0
- package/dist/assets/roster-ws-GsDcHg-w.js +1 -0
- package/dist/assets/{session-store-Coiik-Ib.js → session-store-DGtTSpPv.js} +1 -1
- package/dist/assets/{settings-C65WW7Jn.js → settings-24NUQrlz.js} +1 -1
- package/dist/assets/{settings-Dp5NIt-h.js → settings-BcyGqyX3.js} +1 -1
- package/dist/assets/{settings-B9dVH8oJ.js → settings-BhEHLxqK.js} +1 -1
- package/dist/assets/{settings-BBR9xBqW.js → settings-C67tfoiy.js} +1 -1
- package/dist/assets/{settings-BaZcBGA7.js → settings-CvkIXOQE.js} +1 -1
- package/dist/assets/{settings-BXWyZpz5.js → settings-DGTQ4aKo.js} +1 -1
- package/dist/assets/{settings-BK1-R1dO.js → settings-i7lxRYZu.js} +1 -1
- package/dist/assets/shared-C_yjayIp.js +1 -0
- package/dist/assets/stores-BSWgxKNz.js +6 -0
- package/dist/assets/ui-store-DPNSalc-.js +1 -0
- package/dist/assets/useWebSocket-BBOEYTRy.js +28 -0
- package/dist/assets/{utils-DEzFewqr.js → utils-YTsIExHc.js} +1 -1
- package/dist/assets/{vendor-DffL_bim.js → vendor-B8C0AAAG.js} +30 -30
- package/dist/assets/{view-navigation-BjlXpDXc.js → view-navigation-CV5XT76I.js} +1 -1
- package/dist/assets/ws-client-Cc6w_0zh.js +1 -0
- package/dist/components/AgentOfficeView.d.ts.map +1 -1
- package/dist/components/AgentRosterView.d.ts +16 -0
- package/dist/components/AgentRosterView.d.ts.map +1 -0
- package/dist/components/AgentRuntimePolicyEditor.d.ts +8 -0
- package/dist/components/AgentRuntimePolicyEditor.d.ts.map +1 -0
- package/dist/components/AvailabilityCalendarEditor.d.ts +1 -1
- package/dist/components/AvailabilityCalendarEditor.d.ts.map +1 -1
- package/dist/components/ChangesView.d.ts.map +1 -1
- package/dist/components/ChatInput/slash-commands.d.ts.map +1 -1
- package/dist/components/ChatInput/slash-routing.d.ts +2 -0
- package/dist/components/ChatInput/slash-routing.d.ts.map +1 -1
- package/dist/components/ChatInput.d.ts.map +1 -1
- package/dist/components/ChatView/index.d.ts.map +1 -1
- package/dist/components/ChronicleDashboard.d.ts.map +1 -1
- package/dist/components/CodeEditor.d.ts.map +1 -1
- package/dist/components/CodeMap.d.ts +6 -0
- package/dist/components/CodeMap.d.ts.map +1 -1
- package/dist/components/ContextDashboard.d.ts.map +1 -1
- package/dist/components/CronTrigger.d.ts +1 -1
- package/dist/components/CronTrigger.d.ts.map +1 -1
- package/dist/components/CustomRosterPanel.d.ts +38 -0
- package/dist/components/CustomRosterPanel.d.ts.map +1 -0
- package/dist/components/DesignGalleryView.d.ts.map +1 -1
- package/dist/components/FileActivityDrawer.d.ts +14 -0
- package/dist/components/FileActivityDrawer.d.ts.map +1 -1
- package/dist/components/FleetMonitor.d.ts.map +1 -1
- package/dist/components/KanbanDecompositionPanel.d.ts +28 -0
- package/dist/components/KanbanDecompositionPanel.d.ts.map +1 -0
- package/dist/components/KanbanTaskTree.d.ts +13 -0
- package/dist/components/KanbanTaskTree.d.ts.map +1 -0
- package/dist/components/KanbanVerificationDashboard.d.ts +12 -0
- package/dist/components/KanbanVerificationDashboard.d.ts.map +1 -0
- package/dist/components/KanbanView.d.ts +17 -1
- package/dist/components/KanbanView.d.ts.map +1 -1
- package/dist/components/MailboxDetailView.d.ts.map +1 -1
- package/dist/components/MailboxPanel.d.ts.map +1 -1
- package/dist/components/MemoryManager/MemoryDetail.d.ts +4 -4
- package/dist/components/MemoryManager/MemoryDetail.d.ts.map +1 -1
- package/dist/components/MemoryManager/MemoryEditor.d.ts.map +1 -1
- package/dist/components/MemoryManager/MemoryFilters.d.ts +4 -4
- package/dist/components/MemoryManager/MemoryFilters.d.ts.map +1 -1
- package/dist/components/MemoryManager/MemoryGraph.d.ts +4 -4
- package/dist/components/MemoryManager/MemoryGraph.d.ts.map +1 -1
- package/dist/components/MemoryManager/MemoryList.d.ts +3 -3
- package/dist/components/MemoryManager/MemoryList.d.ts.map +1 -1
- package/dist/components/MemoryManager/index.d.ts.map +1 -1
- package/dist/components/MemoryManager/shared.d.ts +15 -15
- package/dist/components/MemoryManager/shared.d.ts.map +1 -1
- package/dist/components/MessageBubble/index.d.ts.map +1 -1
- package/dist/components/OfficeMapCanvas/resolve.d.ts +17 -1
- package/dist/components/OfficeMapCanvas/resolve.d.ts.map +1 -1
- package/dist/components/OfficeMapCanvas/use-recently-finished.d.ts +21 -0
- package/dist/components/OfficeMapCanvas/use-recently-finished.d.ts.map +1 -0
- package/dist/components/OfficeMapCanvas.d.ts.map +1 -1
- package/dist/components/ProcessMonitor.d.ts.map +1 -1
- package/dist/components/QueuePanel.d.ts.map +1 -1
- package/dist/components/RefinePanel.d.ts +10 -3
- package/dist/components/RefinePanel.d.ts.map +1 -1
- package/dist/components/SddBoardView.d.ts.map +1 -1
- package/dist/components/SddTaskDrawer.d.ts.map +1 -1
- package/dist/components/SearchOverlay.d.ts.map +1 -1
- package/dist/components/SettingsPanel/BrainSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/ChimeraSettingsPanel.d.ts.map +1 -1
- package/dist/components/SettingsPanel/MCPSection.d.ts +4 -0
- package/dist/components/SettingsPanel/MCPSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/PluginToggleList.d.ts.map +1 -1
- package/dist/components/SettingsPanel/PreferenceControls.d.ts +3 -1
- package/dist/components/SettingsPanel/PreferenceControls.d.ts.map +1 -1
- package/dist/components/SettingsPanel/PreferenceToggle.d.ts +3 -1
- package/dist/components/SettingsPanel/PreferenceToggle.d.ts.map +1 -1
- package/dist/components/SettingsPanel/ProviderModelsPanel.d.ts.map +1 -1
- package/dist/components/SettingsPanel/ProviderSection.d.ts.map +1 -1
- package/dist/components/SettingsPanel/index.d.ts.map +1 -1
- package/dist/components/SettingsPanel/local-presets.d.ts +2 -29
- package/dist/components/SettingsPanel/local-presets.d.ts.map +1 -1
- package/dist/components/SetupScreen.d.ts.map +1 -1
- package/dist/components/ShortcutsOverlay.d.ts.map +1 -1
- package/dist/components/SidePanel/AgentsPanel.d.ts.map +1 -1
- package/dist/components/SidePanel/SessionPanel.d.ts.map +1 -1
- package/dist/components/SidePanel/SkillsList.d.ts.map +1 -1
- package/dist/components/SkillDetailView.d.ts.map +1 -1
- package/dist/components/TaskVerificationSection.d.ts +15 -0
- package/dist/components/TaskVerificationSection.d.ts.map +1 -0
- package/dist/components/TechStackView/DependencyDetail.d.ts +2 -1
- package/dist/components/TechStackView/DependencyDetail.d.ts.map +1 -1
- package/dist/components/TechStackView/DependencyTable.d.ts +2 -1
- package/dist/components/TechStackView/DependencyTable.d.ts.map +1 -1
- package/dist/components/TechStackView/index.d.ts.map +1 -1
- package/dist/components/TechStackView/shared.d.ts +37 -4
- package/dist/components/TechStackView/shared.d.ts.map +1 -1
- package/dist/components/VerificationReportPanel.d.ts +15 -0
- package/dist/components/VerificationReportPanel.d.ts.map +1 -0
- package/dist/components/activity-bar/index.d.ts.map +1 -1
- package/dist/components/agents/AgentDetailSection.d.ts.map +1 -1
- package/dist/components/agents/AgentRosterCard.d.ts.map +1 -1
- package/dist/components/agents/FleetSummaryBar.d.ts.map +1 -1
- package/dist/components/codemap-model.d.ts +9 -0
- package/dist/components/codemap-model.d.ts.map +1 -1
- package/dist/components/ui/api-key-display.d.ts +14 -0
- package/dist/components/ui/api-key-display.d.ts.map +1 -0
- package/dist/components/ui/empty-state.d.ts +29 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/progress-ring.d.ts +10 -0
- package/dist/components/ui/progress-ring.d.ts.map +1 -0
- package/dist/hooks/useGlobalKeyboardShortcuts.d.ts +1 -1
- package/dist/hooks/useGlobalKeyboardShortcuts.d.ts.map +1 -1
- package/dist/hooks/useWebSocket.d.ts +13 -13
- package/dist/hooks/useWebSocket.d.ts.map +1 -1
- package/dist/hooks/ws-handlers/chat-handlers.d.ts.map +1 -1
- package/dist/hooks/ws-handlers/fleet-handlers.d.ts.map +1 -1
- package/dist/hooks/ws-handlers/session-handlers.d.ts.map +1 -1
- package/dist/hooks/ws-handlers.d.ts +8 -7
- package/dist/hooks/ws-handlers.d.ts.map +1 -1
- package/dist/index.css +258 -7
- package/dist/index.css.map +2 -2
- package/dist/index.html +24 -23
- package/dist/index.js +14600 -8873
- package/dist/index.js.map +4 -4
- package/dist/lib/agent-office.d.ts +22 -0
- package/dist/lib/agent-office.d.ts.map +1 -1
- package/dist/lib/kanban-verification.d.ts +52 -0
- package/dist/lib/kanban-verification.d.ts.map +1 -0
- package/dist/lib/model-calendar.d.ts +1 -1
- package/dist/lib/model-calendar.d.ts.map +1 -1
- package/dist/lib/model-matrix-routes.d.ts +2 -191
- package/dist/lib/model-matrix-routes.d.ts.map +1 -1
- package/dist/lib/plugin-enablement.d.ts +1 -1
- package/dist/lib/plugin-enablement.d.ts.map +1 -1
- package/dist/lib/roster-ws.d.ts +48 -0
- package/dist/lib/roster-ws.d.ts.map +1 -0
- package/dist/lib/view-navigation.d.ts +1 -1
- package/dist/lib/view-navigation.d.ts.map +1 -1
- package/dist/lib/ws-client-utils.d.ts +1 -2
- package/dist/lib/ws-client-utils.d.ts.map +1 -1
- package/dist/lib/ws-client.d.ts +30 -22
- package/dist/lib/ws-client.d.ts.map +1 -1
- package/dist/protocol-compatibility.d.ts +12 -0
- package/dist/protocol-compatibility.d.ts.map +1 -0
- package/dist/providers.json +105 -85
- package/dist/stores/codemap-index-store.d.ts +9 -0
- package/dist/stores/codemap-index-store.d.ts.map +1 -0
- package/dist/stores/kanban-store.d.ts +4 -0
- package/dist/stores/kanban-store.d.ts.map +1 -1
- package/dist/stores/local-prefs.d.ts +2 -2
- package/dist/stores/local-prefs.d.ts.map +1 -1
- package/dist/stores/mailbox-store.d.ts +2 -0
- package/dist/stores/mailbox-store.d.ts.map +1 -1
- package/dist/stores/session-store.d.ts +1 -1
- package/dist/stores/session-store.d.ts.map +1 -1
- package/dist/stores/specs-store.d.ts +4 -0
- package/dist/stores/specs-store.d.ts.map +1 -1
- package/dist/stores/types.d.ts +1 -1
- package/dist/stores/types.d.ts.map +1 -1
- package/dist/stores/ui-store.d.ts +6 -4
- package/dist/stores/ui-store.d.ts.map +1 -1
- package/dist/stores/viz-store.d.ts.map +1 -1
- package/dist/types.d.ts +482 -68
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/assets/AnalyticsDashboard--x-f8QI-.js +0 -1
- package/dist/assets/AudienceMemoryPanel-j9I0RvhP.js +0 -3
- package/dist/assets/ChangesView-Bb5LXWiI.js +0 -1
- package/dist/assets/ChronicleDashboard-D34oKMQ_.js +0 -1
- package/dist/assets/CodeEditor-BkIIR8EU.js +0 -1
- package/dist/assets/CodeMap-Ej4UNFUm.js +0 -1
- package/dist/assets/ConfirmModal-4l0Tyazp.js +0 -1
- package/dist/assets/DesignGalleryView-CgLsdzTx.js +0 -1
- package/dist/assets/KanbanView--bFrj9Xa.js +0 -2
- package/dist/assets/MailboxDetailView-C-Vf3h1d.js +0 -1
- package/dist/assets/MemoryManager-DoHNBnKd.js +0 -1
- package/dist/assets/OfficeMapPanel-BMf4PTWo.js +0 -4
- package/dist/assets/ProcessMonitor-BtfARuHq.js +0 -1
- package/dist/assets/SddHub-QgMFn_rC.js +0 -2
- package/dist/assets/SetupScreen-CU7Mq-5T.js +0 -1
- package/dist/assets/SkillDetailView-6ZIVx1BG.js +0 -3
- package/dist/assets/TechStackView-9hfnNKx-.js +0 -1
- package/dist/assets/activity-AfUMXtSI.js +0 -5
- package/dist/assets/activity-Bd_pRifE.js +0 -5
- package/dist/assets/activity-Ct_QOdtL.js +0 -5
- package/dist/assets/activity-Cyx4UukM.js +0 -5
- package/dist/assets/activity-Ukyu3lON.js +0 -5
- package/dist/assets/activity-gaWDc806.js +0 -5
- package/dist/assets/index-DGX8tPCe.css +0 -1
- package/dist/assets/index-OmSX-BAb.js +0 -124
- package/dist/assets/shared-CpXz-tzA.js +0 -1
- package/dist/assets/stores-CUp_ut8r.js +0 -6
- package/dist/assets/ui-store-CwOvhFZG.js +0 -1
- package/dist/assets/useWebSocket-BJorYmOi.js +0 -27
- package/dist/assets/ws-client-Fnmzo7vN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Br as t,Di as n,Ii as r,ca as i,da as a,ga as o,ma as s,mi as c,on as l,qr as u,qt as d,tt as f,xr as p,xt as m}from"./vendor-B8C0AAAG.js";import"./i18n-Cjk0Ya0G.js";import{y as h}from"./index-HYvJnpTs.js";var g=e(o(),1),_=f();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:o}){let{t:s}=a();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),o&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[o===`up`&&(0,_.jsx)(m,{className:`w-3 h-3 text-success`}),o===`down`&&(0,_.jsx)(m,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s(o===`up`?`activity:debug.trendUp`:o===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=a(),[o,f]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,S]=(0,g.useState)(!0),[C,w]=(0,g.useState)(2e3),T=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let i=await t.json();f({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){f(t=>({...t,error:e instanceof Error?e.message:s.t(`activity:debug.fetchFailed`)}))}finally{S(!1)}},[]);return(0,g.useEffect)(()=>{T();let e=setInterval(T,C);return()=>clearInterval(e)},[T,C]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(r,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(l,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:C,onChange:e=>w(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{S(!0),T()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(l,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),o.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(c,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:o.lastUpdated.toLocaleTimeString()})]}),o.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(n,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:o.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(u,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:o.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:d,color:o.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:o.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:t,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:o.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:i,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:o.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:p,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:o.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:m,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:o.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:l,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(o.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:c,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(o.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:r,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(p,{className:`h-4 w-4 text-primary`}),`WebUI Server Process`]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:`Process RAM (RSS)`,value:b(o.system?.memoryUsage?.rss??0),subtitle:o.system?`PID ${o.system.pid}`:void 0,icon:d,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(o.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:r,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(o.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:r,color:`text-success`}),(0,_.jsx)(v,{title:`V8 Heap Limit`,value:b(o.system?.heapLimit??0),subtitle:`Configured old-space ceiling`,icon:p,color:`text-warning`}),(0,_.jsx)(v,{title:`Server Uptime`,value:x(o.system?.uptime??0),subtitle:`Since process start`,icon:c,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:o.fileWatcher,serverPid:o.system?.pid,serverMemory:o.system?.memoryUsage,serverHeapLimit:o.system?.heapLimit,serverUptime:o.system?.uptime},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Cn as t,Ht as n,Pi as r,Yt as i,da as a,ei as o,ga as s,ma as c,ot as l,tt as u}from"./vendor-B8C0AAAG.js";import"./i18n-Cjk0Ya0G.js";import{t as d}from"./useWebSocket-BBOEYTRy.js";import{t as f}from"./utils-YTsIExHc.js";import{s as p}from"./view-navigation-CV5XT76I.js";import{y as m}from"./index-HYvJnpTs.js";var h=e(s(),1);function g(e,t,n){return e<t?t:e>n?n:e}function _(e){let t=/^oklch\(\s*([^)]+)\)$/i.exec(e.trim());if(!t?.[1])return null;let n=(t[1].split(`/`)[0]??``).trim().split(/\s+/);if(n.length<3||!n[0]||!n[1]||!n[2])return null;let r=n[0].endsWith(`%`)?Number.parseFloat(n[0])/100:Number.parseFloat(n[0]),i=n[1].endsWith(`%`)?Number.parseFloat(n[1])/100*.4:Number.parseFloat(n[1]),a=Number.parseFloat(n[2].replace(/deg$/i,``));return[r,i,a].every(Number.isFinite)?[g(r,0,1),Math.max(0,i),a]:null}function v(e){return g(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055,0,1)}function y(e){return Math.round(e*255).toString(16).padStart(2,`0`)}function b(e){let t=_(e);if(!t)return null;let[n,r,i]=t,a=i*Math.PI/180,o=r*Math.cos(a),s=r*Math.sin(a),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return`#${y(v(m))}${y(v(h))}${y(v(g))}`}function x(e){let t=e.trim(),n=b(t);if(n)return n.toLowerCase();let r=/^#([0-9a-f]{6})([0-9a-f]{2})?$/i.exec(t);if(r?.[1])return`#${r[1].toLowerCase()}`;let i=/^#([0-9a-f]{3})$/i.exec(t);return i?.[1]?`#${i[1].split(``).map(e=>e+e).join(``).toLowerCase()}`:null}var S=u(),C=[`web`,`react-native`,`flutter`,`swiftui`,`compose`],w=[`primary`,`accent`,`bg`,`surface`,`fg`,`border`];function T(e,t,n){let r={...e};for(let[e,i]of Object.entries(t))e.startsWith(`light.`)?n===`light`&&(r[e.slice(6)]=i):e.startsWith(`dark.`)?n===`dark`&&(r[e.slice(5)]=i):r[e]=i;return r}function E({t:e,label:t}){let n=e.bg??`#fff`,r=e.surface??n,i=e.fg??`#111`,a=e.muted??i,o=e.primary??`#3b82f6`,s=e.accent??o,c=e.border??a,l=e[`radius-md`]??e.radius??`0.5rem`,u=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,d=e[`font-display`]??e.fontDisplay??u,f=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:n,color:i,fontFamily:u},className:`flex min-w-0 flex-col gap-2 overflow-hidden p-3`,children:[(0,S.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide`,style:{color:a},children:t}),(0,S.jsxs)(`div`,{style:{background:r,border:`1px solid ${c}`,borderRadius:l,boxShadow:f},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:d},className:`text-base font-bold leading-tight`,children:`Aa Heading`}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:a},children:`The quick brown fox jumps over the lazy dog.`}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:o,color:n,borderRadius:l},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:`Primary`}),(0,S.jsx)(`span`,{style:{border:`1px solid ${c}`,color:i,borderRadius:l},className:`shrink-0 px-2 py-1 text-[10px]`,children:`Ghost`}),(0,S.jsx)(`span`,{style:{background:s,color:n,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:`Badge`})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${c}`,borderRadius:l,color:a},className:`text-[10px] px-2 py-1.5 mt-1`,children:`Input field…`})]})]})}function D({kit:e,overrides:t,onSet:n}){let[r,i]=(0,h.useState)(`light`),{t:o}=a(),s=T(r===`light`?e.light:e.dark,t,r);return(0,S.jsxs)(`div`,{className:`mt-1 rounded-lg border border-border/60 p-2 bg-muted/30`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:o(`activity:design.colors`)}),(0,S.jsx)(`div`,{className:`ml-auto inline-flex rounded border border-border/60 overflow-hidden`,children:[`light`,`dark`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:f(`text-[10px] px-1.5 py-0.5`,r===e?`bg-primary text-primary-foreground`:`text-muted-foreground`),children:e},e))})]}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:w.filter(e=>s[e]).map(e=>{let t=x(s[e]??``)??`#000000`;return(0,S.jsxs)(`label`,{className:`flex min-w-[2rem] flex-col items-center gap-0.5`,title:`${e}: ${s[e]}`,children:[(0,S.jsx)(`input`,{type:`color`,value:t,onChange:t=>n(`${r}.${e}`,t.target.value),className:`w-6 h-6 rounded cursor-pointer bg-transparent border border-border/60 p-0`}),(0,S.jsx)(`span`,{className:`text-[8px] text-muted-foreground`,children:e})]},e)})})]})}function O({onTune:e}){let[t,n]=(0,h.useState)(``),r=({label:t,knob:n,values:r})=>(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:t}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(t=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>e({[n]:t}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-primary hover:text-primary-foreground`,children:t},t))})]});return(0,S.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2`,children:[(0,S.jsx)(`span`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:`Tune`}),(0,S.jsx)(r,{label:`Radius`,knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(r,{label:`Density`,knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(r,{label:`Motion`,knob:`motion`,values:[`snappy`,`smooth`,`none`]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`w-16 shrink-0 text-[9px] uppercase text-muted-foreground`,children:`Font`}),(0,S.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t.trim()&&e({font:t.trim()})},placeholder:`Space Grotesk…`,className:`h-6 min-w-0 flex-1 rounded border border-border/60 bg-background/70 px-1.5 text-[10px]`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>t.trim()&&e({font:t.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:`Set`})]})]})}function k({className:e}){let{client:s}=d(),{t:u}=a(),[g,_]=(0,h.useState)([]),[v,y]=(0,h.useState)(null),[b,x]=(0,h.useState)({}),[w,k]=(0,h.useState)(`web`),[A,j]=(0,h.useState)(``),[M,N]=(0,h.useState)(null);(0,h.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.payload;_(t?.kits??[]),y(t?.activeKit??null),x(t?.overrides??{})},t=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}))},n=e=>{let t=e.payload;t?.ok&&t.overrides&&x(t.overrides)},r=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},i=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},a=e=>{let t=e.payload;N(t?.ok?c.t(`activity:design.wrote`,{path:t.path}):c.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},o=e=>{let t=e.payload;if(!t?.ok){N(c.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?c.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):c.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return s.on(`design.list`,e),s.on(`design.use`,t),s.on(`design.set`,n),s.on(`design.tune`,r),s.on(`design.swap`,i),s.on(`design.materialize`,a),s.on(`design.verify`,o),s.send({type:`design.list`}),()=>{s.off(`design.list`,e),s.off(`design.use`,t),s.off(`design.set`,n),s.off(`design.tune`,r),s.off(`design.swap`,i),s.off(`design.materialize`,a),s.off(`design.verify`,o)}},[s]);let P=(0,h.useCallback)(e=>s?.send({type:`design.use`,payload:{kit:e,stack:w}}),[s,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),s?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[s]),I=(0,h.useCallback)(e=>s?.send({type:`design.tune`,payload:{tune:e}}),[s]),L=(0,h.useCallback)(()=>{N(c.t(`activity:design.writing`)),s?.send({type:`design.materialize`,payload:{stack:w}})},[s,w]),R=(0,h.useCallback)(()=>{N(c.t(`activity:design.scanning`)),s?.send({type:`design.verify`})},[s]),z=(0,h.useMemo)(()=>{let e=A.trim().toLowerCase();return[...e?g.filter(t=>t.id.includes(e)||t.name.toLowerCase().includes(e)||t.aesthetic.toLowerCase().includes(e)||t.tags.some(t=>t.includes(e))):g].sort((e,t)=>e.name.localeCompare(t.name))},[g,A]);return(0,S.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)]`,e),children:[(0,S.jsx)(`div`,{className:`border-b border-border/60 p-3`,children:(0,S.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-3 shadow-sm`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,S.jsx)(t,{className:`h-4 w-4`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:u(`activity:design.heading`)}),(0,S.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`activity:design.kitsCount`,{count:z.length})})]})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center lg:justify-end`,children:[(0,S.jsxs)(`label`,{className:`relative min-w-0 flex-1 sm:max-w-xs`,children:[(0,S.jsx)(i,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,S.jsx)(`input`,{value:A,onChange:e=>j(e.target.value),placeholder:u(`activity:design.searchPlaceholder`),className:`h-9 w-full rounded-md border border-border/70 bg-background/70 pl-8 pr-3 text-sm shadow-sm outline-none transition focus:border-primary/40 focus:ring-2 focus:ring-ring/30`})]}),(0,S.jsx)(`select`,{value:w,onChange:e=>k(e.target.value),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm shadow-sm`,title:u(`activity:design.stackTitle`),children:C.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),M&&(0,S.jsx)(`span`,{className:`min-w-0 truncate rounded-md border border-border/60 bg-muted/40 px-2 py-1 text-[11px] text-muted-foreground sm:max-w-56`,children:M}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>p(`chat`),className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,title:u(`common:action.close`),children:(0,S.jsx)(l,{className:`h-4 w-4`})})]})]})})}),(0,S.jsx)(`div`,{ref:m(`design-gallery`),className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain p-3 sm:p-4`,children:z.length===0?(0,S.jsxs)(`div`,{className:`ws-surface mx-auto mt-8 flex max-w-md flex-col items-center gap-3 rounded-xl p-6 text-center text-muted-foreground`,children:[(0,S.jsx)(t,{className:`h-8 w-8 text-primary/60`}),(0,S.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:u(`activity:design.kitsCount`,{count:0})}),(0,S.jsx)(`p`,{className:`text-xs`,children:u(`activity:design.searchPlaceholder`)})]}):(0,S.jsx)(`div`,{className:`grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(min(100%,20rem),1fr))]`,children:z.map(e=>{let t=v===e.id,i=t?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,t?`border-primary/60 ring-1 ring-primary/30`:`border-border/70`),children:[(0,S.jsxs)(`div`,{className:`grid min-h-[12rem] grid-cols-1 sm:grid-cols-2`,children:[(0,S.jsx)(E,{t:T(e.light,i,`light`),label:u(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,i,`dark`),label:u(`activity:designStudio.dark`)})]}),(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 border-t border-border/60 bg-card p-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,S.jsx)(`code`,{className:`text-[10px] text-muted-foreground`,children:e.id}),t&&(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[9px] font-semibold uppercase text-primary ml-auto`,children:[(0,S.jsx)(r,{className:`w-3 h-3`}),` `,u(`activity:design.active`)]})]}),(0,S.jsx)(`p`,{className:`text-[11px] text-muted-foreground leading-snug`,children:e.aesthetic}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>P(e.id),className:f(`rounded-md px-2.5 py-1 text-[11px] font-medium transition`,t?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:u(t?`activity:design.reapply`:`activity:design.use`)}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:L,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:u(`activity:design.materializeTitle`,{stack:w}),children:[(0,S.jsx)(o,{className:`w-3 h-3`}),` `,u(`activity:design.materialize`)]}),t&&(0,S.jsxs)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 rounded-md border border-border/60 px-2 py-1 text-[11px] font-medium hover:bg-muted`,title:u(`activity:design.verifyTitle`),children:[(0,S.jsx)(n,{className:`w-3 h-3`}),` `,u(`activity:design.verify`)]}),(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:e.bestFor})]}),t&&(0,S.jsx)(D,{kit:e,overrides:i,onSet:F}),t&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CUODHW6c.js";import{$t as n,Bn as r,Mt as i,Xt as a,Zn as o,_i as s,ai as c,at as l,cn as u,en as d,gt as f,ia as p,li as m,ln as h,mn as g,ni as _,oa as v,ot as y,ta as b,tt as x,ui as S,yt as C}from"./vendor-DffL_bim.js";import"./i18n-Dk35g-uV.js";import{t as w}from"./useWebSocket-BJorYmOi.js";import{t as T}from"./utils-DEzFewqr.js";import{p as E,t as D}from"./stores-CUp_ut8r.js";import{s as O}from"./view-navigation-BjlXpDXc.js";import{t as k}from"./button-Dy0bAtEY.js";import{i as A}from"./ConfirmModal-4l0Tyazp.js";import{n as ee,r as j,t as M}from"./index-OmSX-BAb.js";var N=e(v(),1),P=x(),F={pending:{icon:(0,P.jsx)(m,{className:`w-4 h-4`}),color:`text-muted-foreground`,label:`Pending`},in_progress:{icon:(0,P.jsx)(c,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,P.jsx)(g,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,P.jsx)(S,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,P.jsx)(n,{className:`w-4 h-4`}),color:`text-info`,label:`Review`},completed:{icon:(0,P.jsx)(s,{className:`w-4 h-4`}),color:`text-success`,label:`Done`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={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 R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:r,agents:i,onAssign:a,compact:o,className:s}){let{t:l}=b(),u=F[e.status],[d,p]=(0,N.useState)(!1),m=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:T(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,s),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,u.color),role:`img`,"aria-label":m?l(`common:status.inProgress`):void 0,children:u.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:T(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(c,{className:`w-3 h-3 animate-spin`,"aria-label":l(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!o&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:l(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:l(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(n,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),a&&i&&i.length>0&&(d?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{a(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:l(`activity:task.unassigned`)}),i.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:l(`activity:task.assignTitle`),children:[(0,P.jsx)(f,{className:`w-3 h-3`}),` `,l(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,label:`Pending`,match:[`pending`,`blocked`]},{key:`in_progress`,label:`In Progress`,match:[`in_progress`]},{key:`review`,label:`Review`,match:[`review`]},{key:`failed`,label:`Failed`,match:[`failed`]},{key:`completed`,label:`Done`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-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 H(){let{client:e}=w(),{t}=b(),n=E(e=>e.phases),[r,i]=(0,N.useState)(`phase`),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),d=(0,N.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),f=(0,N.useMemo)(()=>[...new Set(d.map(e=>e.assignee).filter(e=>!!e))],[d]),p=(0,N.useCallback)(t=>e?.send?.(t),[e]),m=(0,N.useCallback)((e,t)=>p({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[p]),h=(0,N.useCallback)(e=>p({type:`goal.retryTask`,payload:{taskId:e}}),[p]),g=(0,N.useCallback)((e,t)=>p({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[p]),v=(0,N.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&p({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[p]),y=(0,N.useCallback)(e=>{o&&p({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),l(null)},[o,p]),x=(0,N.useCallback)(e=>{o&&p({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),l(null)},[o,p]),S={onStatusChange:m,onRetry:h,agents:f,onAssign:g};function C(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),l(null)}}}function D(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,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:d.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(`phase`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,r===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>i(`status`),className:T(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,r===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(a,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:n.map(e=>{let n=d.filter(t=>t.phaseId===e.id);return(0,P.jsxs)(`div`,{...D(`phase:${e.id}`,()=>y(e.id)),className:T(`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,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:T(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>v(e.id),title:t(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(u,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:n.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:t(`activity:board.dropHere`)}):n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:T(o===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...S})},e.id))})]},e.id)})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:t(`activity:board.status.${e.key}`)},e.key)),n.map(e=>(0,P.jsxs)(U,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=d.filter(n=>n.phaseId===e.id&&t.match.includes(n.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...D(r,()=>x(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,c===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:T(o===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...S})},e.id))},t.key)})]},e.id))]})})]})}function U({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function W({onClose:e}){let{client:n}=w(),{t:a}=b(),s=E(e=>e.phases),c=E(e=>e.overallPercent),f=E(e=>e.autonomous),m=E(e=>e.title),_=E(e=>e.goal),v=E(e=>e.status),x=E(e=>e.lastError),S=E(e=>e.graphs);(0,N.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let A=D(e=>e.worktrees),F=D(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[U,W]=(0,N.useState)(!0),G=s.length>0,K=R!=null&&!G;(0,N.useEffect)(()=>{G&&z(null)},[G]);let q=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:p.t(`activity:goalRun.planningAck`)}),z(e),L(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:U}}),O(`chat`)},[I,R,n,U]),J=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),z(null)},[n]),Y=(0,N.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),X=(0,N.useCallback)(()=>{n?.send?.(v===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,v]),Z=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),Q=(0,N.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),z(null),L(``)},[n]),[te,$]=(0,N.useState)(!1),ne=(0,N.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),re=v===`running`||v===`paused`,ie=v===`stopped`||v===`completed`||v===`failed`,ae=(0,N.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex 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,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(o,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:G&&m||`Goal`}),G&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:goalRun.summary`,{count:s.length,pct:c})})]}),G&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,v===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:v===`paused`||v===`stopped`?`border-warning/40 bg-warning/10 text-warning`:v===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:x??void 0,children:v})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[S.length>0&&(0,P.jsxs)(`select`,{value:G?S.find(e=>e.title===m)?.id??``:``,onChange:e=>ae(e.target.value),title:a(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:a(`activity:goalRun.boardsCount`,{count:S.length})}),S.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),G&&(0,P.jsxs)(`button`,{type:`button`,onClick:Y,title:a(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,f?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(l,{className:`h-3.5 w-3.5`}),` `,a(f?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),re&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:X,title:a(v===`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:[v===`paused`?(0,P.jsx)(h,{className:`h-3.5 w-3.5`}):(0,P.jsx)(g,{className:`h-3.5 w-3.5`}),a(v===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:Z,title:a(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(i,{className:`h-3.5 w-3.5 fill-current`}),` `,a(`activity:goalRun.stop`)]})]}),G&&ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:Q,title:a(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(u,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.newLabel`)]}),te?(0,P.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,P.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:ne,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:a(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:a(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:a(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(C,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.revert`)]})]}),(0,P.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(y,{className:`h-4 w-4`})})]})]}),G&&_&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(d,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:_})]}),G?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(H,{})}):K?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(r,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(d,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(k,{variant:`outline`,onClick:J,className:`gap-2`,children:[(0,P.jsx)(i,{className:`h-4 w-4 fill-current`}),` `,a(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(d,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:a(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),q())}}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.isolateLabel`)]}),(0,P.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,P.jsxs)(k,{onClick:q,disabled:!I.trim(),className:`flex-1 gap-2`,children:[(0,P.jsx)(h,{className:`h-4 w-4`}),a(`activity:goalRun.startButton`)]})}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[a(`activity:goalRun.ctrlHint`),` ·`,` `,a(U?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),A.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:a(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:a(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(M,{}),B?(0,P.jsx)(j,{worktrees:A,baseBranch:F}):(0,P.jsx)(ee,{worktrees:A,baseBranch:F})]})]})]})}export{W as GoalView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-fBghgjNK.js";import{$t as n,Ei as r,Mt as i,Wn as a,_n as o,at as s,da as c,dn as l,fn as u,ga as d,gt as f,li as p,ma as m,mi as h,nn as g,nr as _,ot as v,rn as y,tt as b,vi as x,yi as S,yt as C}from"./vendor-B8C0AAAG.js";import"./i18n-Cjk0Ya0G.js";import{t as w}from"./useWebSocket-BBOEYTRy.js";import{t as T}from"./utils-YTsIExHc.js";import{p as E,t as D}from"./stores-BSWgxKNz.js";import{s as O}from"./view-navigation-CV5XT76I.js";import{t as k}from"./button-5TIs9T5p.js";import{i as A}from"./ConfirmModal-BvW6_eIc.js";import{n as ee,r as j,t as M}from"./index-HYvJnpTs.js";var N=e(d(),1),P=b(),F={pending:{icon:(0,P.jsx)(x,{className:`w-4 h-4`}),color:`text-muted-foreground`,label:`Pending`},in_progress:{icon:(0,P.jsx)(h,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,P.jsx)(o,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,P.jsx)(S,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,P.jsx)(g,{className:`w-4 h-4`}),color:`text-info`,label:`Review`},completed:{icon:(0,P.jsx)(r,{className:`w-4 h-4`}),color:`text-success`,label:`Done`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={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 R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:n,agents:r,onAssign:i,compact:a,className:o}){let{t:s}=c(),l=F[e.status],[u,d]=(0,N.useState)(!1),p=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:T(`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`,o),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:T(`mt-0.5`,l.color),role:`img`,"aria-label":p?s(`common:status.inProgress`):void 0,children:l.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:T(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:T(`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,P.jsx)(h,{className:`w-3 h-3 animate-spin`,"aria-label":s(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!a&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:s(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:s(`activity:task.complete`)}),n&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(g,{className:`w-3 h-3`}),` `,s(`activity:task.retry`)]}),i&&r&&r.length>0&&(u?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{i(e.id,t.target.value),d(!1)},onBlur:()=>d(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:s(`activity:task.unassigned`)}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:s(`activity:task.assignTitle`),children:[(0,P.jsx)(f,{className:`w-3 h-3`}),` `,s(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,label:`Pending`,match:[`pending`,`blocked`]},{key:`in_progress`,label:`In Progress`,match:[`in_progress`]},{key:`review`,label:`Review`,match:[`review`]},{key:`failed`,label:`Failed`,match:[`failed`]},{key:`completed`,label:`Done`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-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 H(){let{client:e}=w(),{t}=c(),r=E(e=>e.phases),[i,a]=(0,N.useState)(`phase`),[o,s]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),f=(0,N.useMemo)(()=>r.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[r]),m=(0,N.useMemo)(()=>[...new Set(f.map(e=>e.assignee).filter(e=>!!e))],[f]),h=(0,N.useCallback)(t=>e?.send?.(t),[e]),g=(0,N.useCallback)((e,t)=>h({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[h]),_=(0,N.useCallback)(e=>h({type:`goal.retryTask`,payload:{taskId:e}}),[h]),v=(0,N.useCallback)((e,t)=>h({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[h]),y=(0,N.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&h({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[h]),b=(0,N.useCallback)(e=>{o&&h({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),d(null)},[o,h]),x=(0,N.useCallback)(e=>{o&&h({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),d(null)},[o,h]),S={onStatusChange:g,onRetry:_,agents:m,onAssign:v};function C(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),d(null)}}}function D(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,u!==e&&d(e)},onDragLeave:()=>d(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":u===e||void 0}}return r.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:r.length,tasks:f.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(`phase`),className:T(`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,P.jsx)(p,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(`status`),className:T(`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,P.jsx)(n,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),i===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:r.map(e=>{let n=f.filter(t=>t.phaseId===e.id);return(0,P.jsxs)(`div`,{...D(`phase:${e.id}`,()=>b(e.id)),className:T(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,u===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:T(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),title:t(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(l,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:n.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:t(`activity:board.dropHere`)}):n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:T(o===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...S})},e.id))})]},e.id)})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:t(`activity:board.status.${e.key}`)},e.key)),r.map(e=>(0,P.jsxs)(U,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:T(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=f.filter(n=>n.phaseId===e.id&&t.match.includes(n.status)),r=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...D(r,()=>x(t.key)),className:T(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,u===r?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...C(e.id),className:T(o===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...S})},e.id))},t.key)})]},e.id))]})})]})}function U({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function W({onClose:e}){let{client:n}=w(),{t:r}=c(),d=E(e=>e.phases),f=E(e=>e.overallPercent),p=E(e=>e.autonomous),h=E(e=>e.title),g=E(e=>e.goal),b=E(e=>e.status),x=E(e=>e.lastError),S=E(e=>e.graphs);(0,N.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let A=D(e=>e.worktrees),F=D(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[U,W]=(0,N.useState)(!0),G=d.length>0,K=R!=null&&!G;(0,N.useEffect)(()=>{G&&z(null)},[G]);let q=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:m.t(`activity:goalRun.planningAck`)}),z(e),L(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:U}}),O(`chat`)},[I,R,n,U]),J=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),z(null)},[n]),Y=(0,N.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),X=(0,N.useCallback)(()=>{n?.send?.(b===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,b]),Z=(0,N.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),Q=(0,N.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),z(null),L(``)},[n]),[te,$]=(0,N.useState)(!1),ne=(0,N.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),re=b===`running`||b===`paused`,ie=b===`stopped`||b===`completed`||b===`failed`,ae=(0,N.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex 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,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(_,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:G&&h||`Goal`}),G&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:goalRun.summary`,{count:d.length,pct:f})})]}),G&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,b===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:b===`paused`||b===`stopped`?`border-warning/40 bg-warning/10 text-warning`:b===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:x??void 0,children:b})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[S.length>0&&(0,P.jsxs)(`select`,{value:G?S.find(e=>e.title===h)?.id??``:``,onChange:e=>ae(e.target.value),title:r(`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,P.jsx)(`option`,{value:``,disabled:!0,children:r(`activity:goalRun.boardsCount`,{count:S.length})}),S.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),G&&(0,P.jsxs)(`button`,{type:`button`,onClick:Y,title:r(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,p?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(s,{className:`h-3.5 w-3.5`}),` `,r(p?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),re&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:X,title:r(b===`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:[b===`paused`?(0,P.jsx)(u,{className:`h-3.5 w-3.5`}):(0,P.jsx)(o,{className:`h-3.5 w-3.5`}),r(b===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:Z,title:r(`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,P.jsx)(i,{className:`h-3.5 w-3.5 fill-current`}),` `,r(`activity:goalRun.stop`)]})]}),G&&ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:Q,title:r(`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,P.jsx)(l,{className:`h-3.5 w-3.5`}),` `,r(`activity:goalRun.newLabel`)]}),te?(0,P.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,P.jsx)(`span`,{className:`text-warning`,children:r(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:ne,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:r(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:r(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:r(`activity: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,P.jsx)(C,{className:`h-3.5 w-3.5`}),` `,r(`activity:goalRun.revert`)]})]}),(0,P.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(v,{className:`h-4 w-4`})})]})]}),G&&g&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(y,{className:`h-3 w-3`}),` `,r(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:g})]}),G?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(H,{})}):K?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(a,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:r(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(y,{className:`h-3 w-3`}),` `,r(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(k,{variant:`outline`,onClick:J,className:`gap-2`,children:[(0,P.jsx)(i,{className:`h-4 w-4 fill-current`}),` `,r(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(y,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:r(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:r(`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())}}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),r(`activity:goalRun.isolateLabel`)]}),(0,P.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,P.jsxs)(k,{onClick:q,disabled:!I.trim(),className:`flex-1 gap-2`,children:[(0,P.jsx)(u,{className:`h-4 w-4`}),r(`activity:goalRun.startButton`)]})}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[r(`activity:goalRun.ctrlHint`),` ·`,` `,r(U?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),A.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:r(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:T(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:r(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(M,{}),B?(0,P.jsx)(j,{worktrees:A,baseBranch:F}):(0,P.jsx)(ee,{worktrees:A,baseBranch:F})]})]})]})}export{W as GoalView};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bi as t,Bt as n,Ct as r,Di as i,Dn as a,Ei as o,Ft as s,Gn as c,Ht as l,Jt as u,Ln as d,Mn as f,Mt as p,Ni as m,Pi as h,Pr as g,Qt as _,Ti as v,Ui as y,Ut as b,Wn as x,Wr as S,Yt as C,Zt as w,_n as T,bi as ee,bt as E,ca as D,dn as te,dr as O,ei as ne,en as re,fn as ie,ga as k,hi as ae,ht as oe,ji as A,li as se,ni as ce,nn as le,oi as ue,on as de,ot as j,rn as fe,ta as pe,tt as me,vr as he,wt as ge,yi as M,zt as _e}from"./vendor-B8C0AAAG.js";import{n as N}from"./ui-store-DPNSalc-.js";import{t as ve}from"./ws-client-Cc6w_0zh.js";import{t as P}from"./utils-YTsIExHc.js";import{t as ye}from"./session-store-DGtTSpPv.js";import{b as be,j as xe,u as Se}from"./stores-BSWgxKNz.js";import{n as Ce,t as we}from"./ModelPicker-DOXb0iz4.js";import{d as Te,f as F,y as Ee}from"./index-HYvJnpTs.js";import{n as De,t as Oe}from"./progress-ring-CGN0o9DE.js";var I=e(k(),1);function ke(e){let t=xe(e=>e.wsUrl),n=xe(e=>e.provider),r=xe(e=>e.model),[i,a]=(0,I.useState)([]),[o,s]=(0,I.useState)([]),[c,l]=(0,I.useState)({}),[u,d]=(0,I.useState)(``),[f,p]=(0,I.useState)(``);return(0,I.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,I.useEffect)(()=>{e&&ve(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}function Ae(e,t=!0){(0,I.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 je=4320*60*1e3,L=new Set([`completed`,`archived`]);function Me(e,t){let n=Ge(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Ve(t.liveAgentIdentities),i=Ie(e,t.defaultReviewStaleAfterMs??je),a=Fe(e),o=[];for(let s of e.tasks)L.has(s.status)||(Ne(o,s,t.requireDueDate===!0),Pe(o,s,n,r),R(o,s,n,i),a.length>1&&z(o,s,a));return o.sort(Ke),{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 Ne(e,t,n){V(t.description)||H(e,t,`missing-description`,`warning`,`Add a description`),ze(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`),!Ue(t.labels)&&!Ue(t.tags)&&H(e,t,`missing-labels`,`warning`,`Add labels or tags`),!Ue(t.childTaskIds)&&!Ue(t.subtasks)&&H(e,t,`missing-subtasks`,`warning`,`Define subtasks`),Ue(t.successCriteria)||H(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function Pe(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=ze(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=Ge(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 R(e,t,n,r){if(t.status!==`review`)return;let i=Re(t,`review`)??Ge(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 z(e,t,n){let r=Le(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 Fe(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=Be(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=Be(e);if(t.length>1)return t}}return[]}function Ie(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(We(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(We(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(We(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function Le(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=He(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:Ge(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Re(e,t){let n=null;for(let r of Le(e))B(r.state)!==B(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function ze(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(V)}function Be(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=He(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function Ve(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 He(...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 Ue(e){return Array.isArray(e)&&e.length>0}function We(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Ge(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 Ke(e,t){let n=qe(e.severity)-qe(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function qe(e){return e===`error`?0:1}var Je=[`id`,`name`,`type`];function U(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 Je){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function Ye(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var Xe=new Set([`completed`,`review`,`failed`]);function Ze(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(Xe.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 Qe(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 $e(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}var W=me();function G({options:e,selected:t,onChange:n,placeholder:r,emptyLabel:i}){let[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(``),l=(0,I.useRef)(null);(0,I.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,I.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),d=(0,I.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,W.jsxs)(`div`,{ref:l,className:`relative`,children:[t.length>0&&(0,W.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:t.map(e=>(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,W.jsx)(`span`,{className:`max-w-[150px] truncate`,children:u(e)}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>f(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${u(e)}`,children:(0,W.jsx)(j,{size:11})})]},e))}),(0,W.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,W.jsx)(te,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:r??`Add…`}),(0,W.jsx)(m,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),a&&(0,W.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,W.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,W.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,W.jsx)(`button`,{type:`button`,onClick:()=>c(``),className:`text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(j,{className:`h-3 w-3`})})]}),(0,W.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[d.map(e=>{let n=t.includes(e.value);return(0,W.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,W.jsx)(h,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,W.jsx)(`span`,{className:`w-3 shrink-0`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,W.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,W.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),d.length===0&&(0,W.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?i??`Nothing available`:`No match`})]})]})]})}function et({audit:e,onSelectTask:t}){let[n,r]=(0,I.useState)(!0),a=(0,I.useId)();if((0,I.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let o=tt(e.issues);return(0,W.jsxs)(`section`,{"aria-labelledby":`${a}-title`,className:`shrink-0 border-b border-warning/25 bg-card/95 shadow-[inset_0_1px_0_hsl(var(--warning)/0.08)]`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,W.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,W.jsx)(s,{size:14,"aria-hidden":`true`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`h2`,{id:`${a}-title`,className:`text-xs font-semibold text-foreground`,children:[`Kanban Cleaner found `,e.issues.length,` `,e.issues.length===1?`issue`:`issues`]}),(0,W.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,W.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,W.jsx)(i,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,W.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,W.jsx)(E,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,W.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":a,"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,W.jsx)(m,{size:14,"aria-hidden":`true`,className:P(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,W.jsx)(`ul`,{id:a,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:o.map(({taskId:e,taskTitle:n,issues:r})=>(0,W.jsx)(`li`,{children:(0,W.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,W.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,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,W.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 tt(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}var nt={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function rt({title:e,value:t,inherited:n,onSave:r}){let[i,a]=(0,I.useState)(t??nt),[o,s]=(0,I.useState)(at(t?.allow??[])),[c,u]=(0,I.useState)(at(t?.deny??[])),[d,f]=(0,I.useState)(null);return(0,I.useEffect)(()=>{a(t??nt),s(at(t?.allow??[])),u(at(t?.deny??[])),f(null)},[t]),(0,W.jsxs)(`details`,{className:`rounded-md border border-primary/25 bg-primary/5`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-xs font-semibold`,children:[(0,W.jsx)(l,{size:14,className:`text-primary`}),(0,W.jsx)(`span`,{children:e}),(0,W.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,W.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[n?.enabled&&(0,W.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,W.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:i.enabled,onChange:e=>a({...i,enabled:e.target.checked})}),`Enable this boundary layer`]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Outside scope`}),(0,W.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,W.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,W.jsx)(`option`,{value:`block`,children:`Always block`})]})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Shell / opaque tools`}),(0,W.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,W.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,W.jsx)(`option`,{value:`block`,children:`Always block`}),(0,W.jsx)(`option`,{value:`allow`,children:`Allow`})]})]})]}),(0,W.jsx)(it,{label:`Allow selectors`,value:o,onChange:s}),(0,W.jsx)(it,{label:`Deny selectors`,value:c,onChange:u}),(0,W.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.`}),d&&(0,W.jsx)(`div`,{className:`text-destructive`,children:d}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=ot(o),t=ot(c);r({...i,allow:e,...t.length?{deny:t}:{}}),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},className:`inline-flex h-8 flex-1 items-center justify-center gap-2 rounded bg-primary text-primary-foreground`,children:[(0,W.jsx)(_,{size:13}),` Save boundary`]}),t&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:`Remove layer`})]})]})]})}function it({label:e,value:t,onChange:n}){return(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,W.jsx)(`textarea`,{rows:3,value:t,onChange:e=>n(e.target.value),className:`w-full resize-y rounded border bg-background px-2 py-1.5 font-mono text-[11px] outline-none focus:border-primary`})]})}function at(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
+
`)}function ot(e){let t=new Set([`file`,`directory`,`package`,`glob`]),n=new Set([`read`,`write`,`read_write`]);return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,r)=>{let i=e.indexOf(`:`),a=e.indexOf(`:`,i+1);if(i<=0||a<=i+1||a===e.length-1)throw Error(`Boundary line ${r+1} must use kind:access:path.`);let o=e.slice(0,i),s=e.slice(i+1,a),c=e.slice(a+1).trim();if(!t.has(o))throw Error(`Boundary line ${r+1} has unknown kind.`);if(!n.has(s))throw Error(`Boundary line ${r+1} has unknown access.`);return{kind:o,access:s,path:c}})}function st({board:e,sendKanban:t,onSelectTask:n}){let[r,i]=(0,I.useState)(!1),a=e.tasks.filter(e=>e.decomposition?.status===`proposed`);return a.length?(0,W.jsxs)(`div`,{className:`shrink-0 border-b border-warning/30 bg-warning/5 px-4 py-2`,children:[(0,W.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,W.jsx)(A,{size:13}):(0,W.jsx)(m,{size:13}),(0,W.jsx)(w,{size:13}),a.length,` decomposition proposal`,a.length>1?`s`:``,` awaiting approval`]}),!r&&(0,W.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:a.map(r=>(0,W.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(r.id),className:`min-w-0 flex-1 truncate text-left hover:underline`,children:[r.title,(0,W.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`→ `,r.decomposition?.proposedSubtasks.length??0,` subtasks`]})]}),(0,W.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,W.jsx)(h,{size:12}),` Approve`]}),(0,W.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,W.jsx)(j,{size:12}),` Reject`]})]},r.id))})]}):null}var ct=[`assessed`,`proposed`,`approval`,`applied`];function lt(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function ut({board:e,task:t,sendKanban:n,onSelectTask:r}){let i=t.decomposition,a=lt(t),o=(0,I.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,W.jsxs)(`div`,{className:`mt-4 rounded-md border p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,W.jsx)(w,{size:13}),`Decomposition`]}),(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 text-[11px]`,children:[ct.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,W.jsx)(`span`,{className:`text-muted-foreground/50`,children:`→`}),(0,W.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,W.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[t.atomicityAssessment.verdict,` · score `,t.atomicityAssessment.score]})]}),!i&&t.atomicityAssessment?.verdict===`needs_decomposition`&&(0,W.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,W.jsx)(`ul`,{className:`ml-4 mt-1 list-disc`,children:t.atomicityAssessment.criteria.filter(e=>e.score<1).map(e=>(0,W.jsx)(`li`,{children:e.reason},e.id))})]}),i&&o&&(0,W.jsxs)(W.Fragment,{children:[i.rationale&&(0,W.jsxs)(`div`,{className:`mb-2 text-[11px] text-muted-foreground`,children:[`“`,i.rationale,`”`]}),(0,W.jsx)(`div`,{className:`h-64 overflow-hidden rounded-md border`,children:(0,W.jsx)(De,{tasks:o.tasks,columns:o.columns,onTaskClick:t=>{e.tasks.some(e=>e.id===t)&&r(t)}})}),(0,W.jsx)(`ul`,{className:`mt-2 space-y-1 text-[11px]`,children:i.proposedSubtasks.map((e,t)=>(0,W.jsxs)(`li`,{className:`rounded bg-muted/40 px-2 py-1`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:e.title}),e.successCriteria?.length?(0,W.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`✓ `,e.successCriteria.join(` · `)]}):null]},`${e.title}-${t}`))}),i.status===`proposed`&&(0,W.jsxs)(`div`,{className:`mt-2 flex gap-1.5`,children:[(0,W.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,W.jsx)(h,{size:13}),` Approve & split`]}),(0,W.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,W.jsx)(j,{size:13}),` Reject`]})]}),i.status===`applied`&&o.appliedChildren.length>0&&(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.appliedChildren.map(e=>(0,W.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,W.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`[`,e.status,`]`]})]},e.id))}),i.status===`rejected`&&i.resolutionReason&&(0,W.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Rejected: `,i.resolutionReason]})]})]})}var dt={unverified:{label:`unverified`,className:`bg-muted text-muted-foreground`,icon:n},running:{label:`verifying…`,className:`bg-info/10 text-info`,icon:x},passed:{label:`verified`,className:`bg-success/10 text-success`,icon:l},failed:{label:`verification failed`,className:`bg-destructive/10 text-destructive`,icon:_e},needs_human:{label:`needs review`,className:`bg-warning/10 text-warning`,icon:E},incomplete:{label:`incomplete`,className:`bg-warning/10 text-warning`,icon:E}};function ft({task:e}){return e.status===`completed`?(0,W.jsx)(h,{size:13,className:`text-success`}):e.status===`failed`?(0,W.jsx)(j,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,W.jsx)(x,{size:13,className:`animate-spin text-info`}):(0,W.jsx)(v,{size:13,className:`text-muted-foreground`})}function pt({board:e,selectedTaskId:t,onSelectTask:n}){let r=Se(e=>e.verificationActivity),i=(0,I.useMemo)(()=>$e(Qe(e)),[e]);return i.length?(0,W.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,W.jsx)(`ul`,{className:`space-y-0.5`,children:i.map(({task:i,depth:a,children:o})=>{let s=dt[Ye(i,r[`${e.id}:${i.id}`])],c=s.icon,l=i.atomicityAssessment?.verdict;return(0,W.jsx)(`li`,{children:(0,W.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,W.jsx)(A,{size:12,className:`shrink-0 text-muted-foreground`}):(0,W.jsx)(`span`,{className:`w-3 shrink-0`}),(0,W.jsx)(ft,{task:i}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:i.title}),i.atomic&&(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-warning/15 px-1 py-0.5 text-[10px] text-warning`,children:`atomic`}),l&&l!==`atomic`&&(0,W.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,W.jsx)(`span`,{className:`shrink-0 rounded bg-warning/10 px-1 py-0.5 text-[10px] text-warning`,children:`proposal pending`}),(0,W.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,W.jsx)(c,{size:11,className:s.label===`verifying…`?`animate-spin`:void 0}),s.label]})]})},i.id)})})}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No tasks on this board yet.`})}function mt({label:e,value:t,tone:n}){return(0,W.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,W.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,W.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,W.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,W.jsxs)(`div`,{className:P(`flex items-center gap-2 border-b px-3 py-2 text-xs font-semibold`,n),children:[(0,W.jsx)(t,{size:14}),e,(0,W.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:r.length})]}),(0,W.jsx)(`ul`,{className:`divide-y`,children:r.map(e=>(0,W.jsx)(`li`,{children:(0,W.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,W.jsx)(`span`,{className:`font-medium`,children:e.primary}),e.secondary&&(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.secondary})]})},e.id))})]}):null}function gt({board:e,onSelectTask:t}){let r=(0,I.useMemo)(()=>Ze(e),[e]);return(0,W.jsxs)(`div`,{className:`h-full space-y-4 overflow-y-auto p-4`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4 rounded-md border bg-background p-4`,children:[(0,W.jsx)(Oe,{pct:r.gradedTasks?r.passed/r.gradedTasks*100:0}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-sm font-semibold`,children:`Definition of Done`}),(0,W.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.passed,` of `,r.gradedTasks,` graded tasks verified passed ·`,` `,r.totalTasks,` tasks total`]})]})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[(0,W.jsx)(mt,{label:`verified`,value:r.passed,tone:`success`}),(0,W.jsx)(mt,{label:`failed`,value:r.failed,tone:`destructive`}),(0,W.jsx)(mt,{label:`needs human`,value:r.needsHuman,tone:`warning`}),(0,W.jsx)(mt,{label:`incomplete`,value:r.incomplete,tone:`warning`}),(0,W.jsx)(mt,{label:`unverified`,value:r.unverified,tone:`muted`})]}),(0,W.jsx)(ht,{title:`Failing checks`,icon:_e,tone:`text-destructive`,onSelectTask:t,rows:r.failingChecks.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:`${t.description}${t.error?` — ${t.error}`:``}`}))}),(0,W.jsx)(ht,{title:`Evidence missing (agent/council checks without backing refs)`,icon:E,tone:`text-warning`,onSelectTask:t,rows:r.missingEvidence.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:t.description}))}),(0,W.jsx)(ht,{title:`Needs decomposition`,icon:w,tone:`text-warning`,onSelectTask:t,rows:r.needsDecomposition.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`atomicity score ${e.atomicityAssessment?.score??`?`} — split before dispatch`}))}),(0,W.jsx)(ht,{title:`Decomposition proposals awaiting approval`,icon:n,tone:`text-info`,onSelectTask:t,rows:r.pendingProposals.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`${e.decomposition?.proposedSubtasks.length??0} proposed subtasks`}))}),r.failingChecks.length===0&&r.missingEvidence.length===0&&r.needsDecomposition.length===0&&r.pendingProposals.length===0&&(0,W.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,W.jsx)(l,{size:14}),`No outstanding verification or decomposition issues on this board.`]})]})}function _t(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function K(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function q(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function J(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?q(K(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 vt(e){let t=K(e.before),n=K(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 yt(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 bt(e){let t=K(e.before),n=K(e.after);if(e.type.startsWith(`task.file.`)){let e=q(n.filePath),t=q(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[q(n.outcome),q(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=q(t.columnId),r=q(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=vt(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=q(t.stage),r=q(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=q(n.name)??q(n.agentId)??q(n.role),t=q(n.provider),r=q(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[q(n.description),q(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[q(n.name),q(n.status)].filter(Boolean).join(` · `)||void 0}function xt(e){let t=e.type;return q(K(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 St(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 Ct(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 wt(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 Tt({event:e}){let t=K(e.after),n=q(t.provider),r=q(t.model),i=q(t.modelRouting),a=q(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=q(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,W.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,W.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,W.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,W.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,W.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,W.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,W.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function Et({task:e,events:t,sessionId:n,loading:r=!1,error:i,onRefresh:a}){let[o,s]=(0,I.useState)(`all`),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(!1),f=(0,I.useMemo)(()=>wt(e,t,n),[e,t,n]),p=(0,I.useMemo)(()=>({all:f.length,execution:f.filter(e=>J(e)===`execution`).length,changes:f.filter(e=>J(e)===`changes`).length,notes:f.filter(e=>J(e)===`notes`).length,failures:f.filter(e=>J(e)===`failures`).length}),[f]),m=(0,I.useMemo)(()=>{let e=c.trim().toLowerCase();return f.filter(t=>o!==`all`&&J(t)!==o?!1:!e||[yt(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=F(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,W.jsxs)(`section`,{"aria-label":`Task activity`,className:`mt-5`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,W.jsx)(D,{className:`size-3.5 text-primary`}),(0,W.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Activity ledger`}),(0,W.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,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(_t(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,W.jsx)(h,{className:`size-3 text-success`}):(0,W.jsx)(ue,{className:`size-3`})}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(_t(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,W.jsx)(ne,{className:`size-3`})}),a&&(0,W.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,W.jsx)(de,{className:P(`size-3`,r&&`animate-spin`)})})]})]}),(0,W.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,W.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,W.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,W.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,W.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,W.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,W.jsxs)(`div`,{className:`relative mb-3`,children:[(0,W.jsx)(C,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,W.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,W.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,W.jsx)(j,{className:`size-3`})})]}),i&&(0,W.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,W.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,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:_.map(e=>{let t=bt(e),r=e.sessionId??n,i=vt(e),a=J(e)===`failures`,o=e.type.includes(`completed`)||q(K(e.after).outcome)===`succeeded`;return(0,W.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,W.jsx)(`span`,{className:P(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,xt(e))}),(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:yt(e)}),(0,W.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,W.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:St(e.ts)})]}),t&&(0,W.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,W.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,W.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,W.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,W.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,W.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,W.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,W.jsx)(`span`,{className:`line-through opacity-70`,children:Ct(e.before)}),` `,(0,W.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,W.jsx)(`span`,{className:`text-foreground`,children:Ct(e.after)})]})]},e.field))}),(0,W.jsx)(Tt,{event:e}),(e.actor||r||e.subagentId||e.runTaskId||e.correlationId)&&(0,W.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),r&&(0,W.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:r,children:[`session:`,r]}),e.subagentId&&(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,W.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:`Full event payload`}),(0,W.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,W.jsx)(Te,{page:g.page,pageSize:g.pageSize,totalItems:g.totalItems,onPageChange:g.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function Dt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Ot(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 kt(e,t){return Y(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 At(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function jt(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 Mt(e,t,n){let r=wt(e,t,n).filter(Ot).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=Dt(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=kt(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=Y(t.name)??Y(t.agentId)??Y(t.role)??e.actor??u.owner,u.provider=Y(t.provider)??u.provider,u.model=Y(t.model)??u.model,u.routingMode=Y(t.modelRouting)??u.routingMode,u.fallbackProfile=Y(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??Y(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??Y(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=Y(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=Y(t.error)??e.note??u.error),At(l)&&(u.endedAt=e.ts),i.set(a,u),s=At(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:jt(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function Nt(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 Pt(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 Ft({task:e,events:t,sessionId:n}){let r=Mt(e,t,n),i=F(r,8,e.id);return r.length?(0,W.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(O,{className:`size-4 text-primary`}),(0,W.jsx)(`span`,{className:`text-xs font-semibold`,children:`Execution attempts`}),(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[r.length,` total`]}),(0,W.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${Pt(r[0].status)}`,children:[`latest:`,r[0].status]}),(0,W.jsx)(m,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[i.pageItems.map(e=>(0,W.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,W.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,W.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${Pt(e.status)}`,children:e.status}),(0,W.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,W.jsx)(ge,{className:`size-3`}),` `,Nt(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,W.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(y,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,W.jsx)(re,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,W.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,W.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,W.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,W.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,W.jsx)(`strong`,{children:`Error:`}),` `,e.error]}),e.result&&(0,W.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,W.jsx)(`strong`,{children:`Result:`}),` `,e.result]})]},e.attempt)),(0,W.jsx)(Te,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function It(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return U(e)}function Lt(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 Rt(e,t,n,r,i,a,o){let s=wt(t,n,r),c=Lt(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=It(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=X(u?.modelRouting)??X(f.modelRouting)??`session`,m=X(u?.provider)??X(f.provider)??(p===`session`?X(i):void 0),h=X(u?.model)??X(f.model)??(p===`session`?X(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(X).filter(e=>e!==void 0),_=X(u?.fallbackProfile)??X(f.fallbackProfile),v=X(u?.name)??X(u?.agentId)??X(u?.role)??X(t.assignee)??X(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(It(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=>J(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 ${zt(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 zt(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Bt(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 Z({label:e,value:t,mono:n=!1}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,W.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function Vt({icon:e,title:t,children:n}){return(0,W.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,W.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,W.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function Ht({items:e}){return e.length?(0,W.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,W.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,W.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`None`})}function Ut({board:e,task:n,events:r,presence:i,sessionId:a,sessionProvider:o,sessionModel:s}){let c=Rt(e,n,r,a,o,s,i),u=n.assignment,d=n.successCriteria?.length??0,f=n.successCriteria?.filter(e=>e.status===`passed`).length??0,p=[n.parentTaskId,...n.childTaskIds??[],n.chain?.previousTaskId,n.chain?.nextTaskId,n.mergedIntoTaskId,...n.mergedFromTaskIds??[]].filter(e=>!!e),h=Lt(e,[...new Set(p)]);return(0,W.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(t,{className:`size-4 text-primary`}),(0,W.jsx)(`span`,{className:`text-xs font-semibold`,children:`Task intelligence`}),(0,W.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:n.status}),(0,W.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:[c.eventCount,` events`]}),(0,W.jsx)(m,{className:`size-3.5 text-muted-foreground`})]}),(0,W.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,W.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,W.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:c.column}),(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`stage:`,n.lifecycle?.currentStage??`legacy`]}),(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`priority:`,n.priority]}),(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`type:`,n.type??`inferred`]})]}),(0,W.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,W.jsx)(`strong`,{children:`Why here:`}),` `,c.reason]}),c.blockers.length>0&&(0,W.jsxs)(`p`,{className:`mt-1 text-[10px] text-warning`,children:[c.blockers.length,` unresolved blocker`,c.blockers.length===1?``:`s`]})]}),(0,W.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,W.jsxs)(Vt,{icon:(0,W.jsx)(y,{className:`size-3`}),title:`Ownership & runtime`,children:[(0,W.jsx)(Z,{label:`Owner`,value:c.owner}),(0,W.jsx)(Z,{label:`Assignee`,value:X(n.assignee)??X(n.assignedAgent)??`—`}),(0,W.jsx)(Z,{label:`Agent ID`,value:X(u?.agentId)??`—`,mono:!0}),(0,W.jsx)(Z,{label:`Agent name / role`,value:[X(u?.name),X(u?.role)].filter(Boolean).join(` · `)||`—`}),(0,W.jsx)(Z,{label:`Run status`,value:X(u?.status)??`unassigned`}),(0,W.jsx)(Z,{label:`Subagent`,value:X(u?.subagentId)??`—`,mono:!0}),(0,W.jsx)(Z,{label:`Run task`,value:X(u?.runTaskId)??`—`,mono:!0}),(0,W.jsx)(Z,{label:`Session(s)`,value:c.sessions.join(`, `)||`Unknown`,mono:!0}),(0,W.jsx)(Z,{label:`Users / presence`,value:c.presence.length?c.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,W.jsxs)(Vt,{icon:(0,W.jsx)(re,{className:`size-3`}),title:`Model route & fallback`,children:[(0,W.jsx)(Z,{label:`Routing mode`,value:c.routingMode}),(0,W.jsx)(Z,{label:`Primary`,value:c.primaryModel,mono:!0}),(0,W.jsx)(Z,{label:`Provider`,value:c.provider??`—`,mono:!0}),(0,W.jsx)(Z,{label:`Model`,value:c.model??`—`,mono:!0}),(0,W.jsx)(Z,{label:`Fallback route`,value:c.fallbackRoute,mono:!0}),(0,W.jsx)(Z,{label:`Skills`,value:u?.skills?.map(X).filter(Boolean).join(`, `)||`Default`}),(0,W.jsx)(Z,{label:`Tools`,value:u?.tools?.map(X).filter(Boolean).join(`, `)||`Default toolset`}),(0,W.jsx)(Z,{label:`Capabilities`,value:u?.allowedCapabilities?.map(X).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,W.jsxs)(Vt,{icon:(0,W.jsx)(l,{className:`size-3`}),title:`Execution policy & outcome`,children:[(0,W.jsx)(Z,{label:`Attempts`,value:`${c.attempts}${u?.maxAttempts?` / ${u.maxAttempts}`:``}`}),(0,W.jsx)(Z,{label:`Retry policy`,value:u?.retryPolicy??n.retryPolicy??`off`}),(0,W.jsx)(Z,{label:`Cost ceiling`,value:(u?.costCeilingUsd??n.costCeilingUsd)==null?`Unbounded`:`$${(u?.costCeilingUsd??n.costCeilingUsd).toFixed(2)}`}),(0,W.jsx)(Z,{label:`Failures / done`,value:`${c.failures} / ${c.completions}`}),(0,W.jsx)(Z,{label:`Checks`,value:`${f} / ${d} passed`}),(0,W.jsx)(Z,{label:`Last failure`,value:c.lastFailure??`—`}),(0,W.jsx)(Z,{label:`Result`,value:c.lastResult??`No result recorded`})]}),(0,W.jsxs)(Vt,{icon:(0,W.jsx)(D,{className:`size-3`}),title:`Timing & audit coverage`,children:[(0,W.jsx)(Z,{label:`Created`,value:zt(n.createdAt)}),(0,W.jsx)(Z,{label:`Updated`,value:zt(n.updatedAt)}),(0,W.jsx)(Z,{label:`Due`,value:zt(n.dueDate)}),(0,W.jsx)(Z,{label:`Dispatched`,value:zt(u?.dispatchedAt??u?.claimedAt)}),(0,W.jsx)(Z,{label:`Completed`,value:zt(u?.completedAt??n.completedAt)}),(0,W.jsx)(Z,{label:`Duration`,value:Bt(u?.dispatchedAt??u?.claimedAt,u?.completedAt)}),(0,W.jsx)(Z,{label:`Heartbeat`,value:zt(u?.heartbeatAt)}),(0,W.jsx)(Z,{label:`Lease expires`,value:zt(u?.leaseExpiresAt)}),(0,W.jsx)(Z,{label:`Actors`,value:c.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,W.jsxs)(Vt,{icon:(0,W.jsx)(he,{className:`size-3`}),title:`Dependencies, chain & provenance`,children:[(0,W.jsx)(Z,{label:`Dependencies`,value:(0,W.jsx)(Ht,{items:c.dependencies})}),(0,W.jsx)(Z,{label:`Other relations`,value:(0,W.jsx)(Ht,{items:h})}),(0,W.jsx)(Z,{label:`Chain`,value:n.chain?`${n.chain.chainId} · position ${n.chain.order}`:`None`,mono:!0}),(0,W.jsx)(Z,{label:`Origin system`,value:n.origin?.system??`manual`}),(0,W.jsx)(Z,{label:`Origin IDs`,value:n.origin&&[n.origin.graphId,n.origin.phaseId,n.origin.taskId,n.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,W.jsx)(Z,{label:`Task ID`,value:n.id,mono:!0}),(0,W.jsx)(Z,{label:`Board ID`,value:e.id,mono:!0})]})]})]})}var Wt={passed:{icon:o,label:`Passed`,className:`text-success`},failed:{icon:M,label:`Failed`,className:`text-destructive`},needs_human:{icon:E,label:`Needs Review`,className:`text-warning`},incomplete:{icon:b,label:`Incomplete`,className:`text-muted-foreground`}},Gt={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 Kt(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 qt({verdict:e}){let t=Wt[e],n=t.icon;return(0,W.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,W.jsx)(n,{size:13}),t.label]})}function Jt({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,I.useState)(n);return(0,W.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,W.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,W.jsx)(m,{size:13}):(0,W.jsx)(A,{size:13}),(0,W.jsx)(t,{size:13}),e]}),i&&(0,W.jsx)(`div`,{className:`border-t px-3 py-2 space-y-2`,children:r})]})}function Yt({check:e}){let t=Gt[e.status],[n,r]=(0,I.useState)(!1),i=e.error||e.backingRefs?.length;return(0,W.jsxs)(`div`,{className:`rounded border bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`font-medium ${t.className}`,children:t.label}),(0,W.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:e.type})]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:e.description})]}),i&&(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:n?(0,W.jsx)(m,{size:13}):(0,W.jsx)(A,{size:13})})]}),n&&(0,W.jsxs)(`div`,{className:`mt-2 space-y-1.5 border-t pt-2`,children:[e.error&&(0,W.jsx)(`div`,{className:`rounded bg-destructive/10 px-2 py-1 text-destructive`,children:e.error}),e.backingRefs?.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,W.jsx)(S,{size:11}),(0,W.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.path}),(0,W.jsxs)(`span`,{className:`text-[10px]`,children:[`(`,e.kind,`)`]}),e.summary&&(0,W.jsxs)(`span`,{className:`truncate`,children:[`— `,e.summary]})]},t))]})]})}function Xt({fileScope:e}){return(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Expected `,(0,W.jsx)(`strong`,{children:e.expectedChanges}),` changes`]}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Actual `,(0,W.jsx)(`strong`,{children:e.actualChanges}),` changes`]}),(0,W.jsx)(`span`,{className:e.scopeMatches?`text-success`:`text-destructive`,children:e.scopeMatches?`✅ Scope matches`:`❌ Scope mismatch`})]}),(0,W.jsx)(`div`,{className:`space-y-1`,children:e.files.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground`,children:[(0,W.jsx)(`span`,{className:e.operation===`create`?`text-success`:e.operation===`delete`?`text-destructive`:`text-muted-foreground`,children:e.operation===`create`?`+`:e.operation===`delete`?`−`:`∼`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,W.jsxs)(`span`,{className:`text-[10px]`,children:[e.linesChanged,` line`,e.linesChanged===1?``:`s`]}),!e.expected&&(0,W.jsx)(`span`,{className:`rounded bg-warning/10 px-1 text-[10px] text-warning`,children:`unexpected`})]},t))})]})}function Zt({subtasks:e}){return(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,W.jsxs)(`span`,{children:[`Total `,(0,W.jsx)(`strong`,{children:e.total})]}),(0,W.jsxs)(`span`,{className:`text-success`,children:[`Completed `,(0,W.jsx)(`strong`,{children:e.completed})]}),e.failed>0&&(0,W.jsxs)(`span`,{className:`text-destructive`,children:[`Failed `,(0,W.jsx)(`strong`,{children:e.failed})]})]}),(0,W.jsx)(`div`,{className:`space-y-1`,children:e.children.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.verdict===`passed`?(0,W.jsx)(`span`,{className:`text-success`,children:`✓`}):e.verdict===`failed`?(0,W.jsx)(`span`,{className:`text-destructive`,children:`✗`}):e.verdict===`needs_human`?(0,W.jsx)(`span`,{className:`text-warning`,children:`⚠`}):(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`○`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},t))})]})}function Qt({attachments:e}){return(0,W.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded border bg-muted/30 px-2 py-1.5 text-xs`,children:[(0,W.jsx)(g,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,W.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.path?(0,W.jsxs)(`span`,{className:`truncate block`,children:[e.path,(0,W.jsx)(`span`,{className:`ml-1 rounded bg-muted px-1 text-[10px]`,children:e.kind})]}):(0,W.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px]`,children:e.kind})}),e.content&&(0,W.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 $t({report:e}){return(0,W.jsxs)(`div`,{className:`mt-5 space-y-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Verification Report`}),(0,W.jsx)(qt,{verdict:e.verdict})]}),e.markdownSummary&&(0,W.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:Kt(e.startedAt,e.completedAt)})]}),e.markdownSummary&&(0,W.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,W.jsx)(Jt,{title:`Check Results`,icon:c,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,W.jsx)(Yt,{check:e},e.checkId))}),e.fileScope&&(0,W.jsx)(Jt,{title:`File Scope`,icon:S,defaultOpen:!e.fileScope.scopeMatches,children:(0,W.jsx)(Xt,{fileScope:e.fileScope})}),e.subtasks&&(0,W.jsx)(Jt,{title:`Sub-Tasks`,icon:c,children:(0,W.jsx)(Zt,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,W.jsx)(Jt,{title:`Attachments (${e.attachments.length})`,icon:g,children:(0,W.jsx)(Qt,{attachments:e.attachments})})]})}function en({boardId:e,task:t,sendKanban:r}){return Ye(t,Se(n=>n.verificationActivity[`${e}:${t.id}`]))===`running`?(0,W.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,W.jsx)(x,{size:14,className:`animate-spin`}),`Verification running — checks are being executed…`]}):t.verificationReport?(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)($t,{report:t.verificationReport}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(`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,W.jsxs)(`div`,{className:`mt-4 rounded-md border border-dashed p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(n,{size:14}),(0,W.jsx)(`span`,{className:`font-medium`,children:`Unverified`}),(0,W.jsx)(`span`,{children:`— no verification report exists for this task yet.`})]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(`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 tn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function nn(e){return e===`completed`||e===`failed`||e===`cancelled`}function rn(e,t){return t?Math.round(e/t*100):0}function an(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 _=rn(o.filter(e=>!!e.actor).length,o.length),v=rn(o.filter(e=>!!e.sessionId).length,o.length),y=rn(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={...tn([...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=>nn(String(tn(e.after).status??``))&&!!e.note?.trim()));return nn(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 on(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 sn({board:e,task:t,events:n}){let r=an(e,t,n),i=F(r.findings,8,t.id);return(0,W.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(b,{className:`size-4 text-primary`}),(0,W.jsx)(`span`,{className:`text-xs font-semibold`,children:`Risk & audit quality`}),(0,W.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,W.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:[r.critical,` critical`]}),(0,W.jsx)(m,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,W.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,W.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,W.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,W.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),r.findings.length===0?(0,W.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,W.jsx)(o,{className:`size-4`}),` No deterministic task risks detected.`]}):(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[i.pageItems.map(e=>(0,W.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${on(e.severity)}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,W.jsx)(ce,{className:`size-3.5`}):(0,W.jsx)(E,{className:`size-3.5`}),e.title,(0,W.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[e.category,` · `,e.severity]})]}),(0,W.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:e.detail}),(0,W.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,W.jsx)(`strong`,{children:`Next:`}),` `,e.remediation]})]},e.id)),(0,W.jsx)(Te,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`risk findings`})]})]})]})}var cn=5e3,ln=12;function un(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 dn({presence:e=[]}){return e.length===0?null:(0,W.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,W.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Live board users`}),e.map(e=>(0,W.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,W.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,W.jsx)(ee,{size:13,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,W.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,W.jsx)(ae,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,W.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:un(e.lastSeenAt)})]},e.id))]})}function fn({board:e,snapshot:t,sendKanban:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(!0),[s,c]=(0,I.useState)(`deterministic`),[u,d]=(0,I.useState)(`session`),[f,p]=(0,I.useState)(``),[h,g]=(0,I.useState)(``),[v,y]=(0,I.useState)(``),[b,x]=(0,I.useState)([]),[S,C]=(0,I.useState)([]),[w,T]=(0,I.useState)(10),ee=Ce(r&&s===`agentic`),E=ke(r&&s===`agentic`);(0,I.useEffect)(()=>{let t=e.supervisor;o(t?.enabled??!0),c(t?.mode??`deterministic`),d(t?.routing?.mode??`session`),p(t?.routing?.provider??``),g(t?.routing?.model??``),y(t?.routing?.fallbackProfile??``),x(t?.routing?.fallbackModels??[]),C(t?.skills??[]),T(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,e.supervisor]);let te=()=>{let t={mode:u,...u===`fixed`&&f?{provider:f}:{},...u===`fixed`&&h?{model:h}:{},...u===`fallback_profile`&&v?{fallbackProfile:v}:{},...b.length?{fallbackModels:b}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:a,mode:s,intervalMs:Math.max(2,w)*1e3,recoveryMode:`auto`,...s===`agentic`?{routing:t,skills:S}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},O=a?t?.status??`starting`:`disabled`;return(0,W.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,W.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,W.jsx)(l,{size:13,className:O===`healthy`?`text-success`:`text-warning`}),(0,W.jsx)(`span`,{className:`font-semibold`,children:`Kanban Agent`}),(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[s,` · `,O]}),t?.summary&&(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,W.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?`checked ${Tn(t.lastAuditAt)} ago`:`not checked`}),(0,W.jsx)(m,{size:13,className:P(`transition-transform`,r&&`rotate-180`)})]}),r&&(0,W.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),(0,W.jsx)(`span`,{children:`Watch this board`})]}),(0,W.jsx)($,{label:`Supervisor engine`,value:s,options:[`deterministic`,`agentic`],onChange:e=>c(e)}),(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Audit interval (seconds)`}),(0,W.jsx)(`input`,{type:`number`,min:2,value:w,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,W.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:te,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,W.jsx)(_,{size:13}),` Save`]}),(0,W.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,W.jsx)(D,{size:13}),` Audit now`]})]}),s===`deterministic`?(0,W.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,W.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,W.jsx)($,{label:`Kanban Agent model source`,value:u,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>d(e)}),u===`fixed`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,W.jsx)(we,{value:h||void 0,provider:f||void 0,candidates:ee,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{g(e),p(t)}})]}),u===`fallback_profile`&&(0,W.jsx)($,{label:`Fallback profile (first model is primary)`,value:v,options:Object.keys(E.fallbackProfiles),placeholder:`Select configured profile…`,onChange:y}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Supervisor skills`}),(0,W.jsx)(G,{options:E.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:S,onChange:C,placeholder:`Force-load agentic skills…`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Extra fallback models`}),(0,W.jsx)(G,{options:ee.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:b,onChange:x,placeholder:`Optional ordered fallbacks…`})]})]})]})]})}function pn(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 mn({onClose:e}){let t=xe(e=>e.wsUrl),n=ye(e=>e.session?.id??null),i=be(e=>e.agents),{boards:a,boardTotal:o,activeBoardTotal:s,orphanedBoardTotal:c,activeBoardId:l,activeBoard:u,loading:d,error:f,queueHealth:p,supervisorSnapshot:m,setLoading:h,setActiveBoardId:g}=Se(),[_,v]=(0,I.useState)(``),[y,b]=(0,I.useState)(1),[x,S]=(0,I.useState)([]),[C,w]=(0,I.useState)(``),T=(0,I.useRef)(null);Ae(T);let[ee,E]=(0,I.useState)(``),[D,O]=(0,I.useState)(null),[ne,re]=(0,I.useState)([]),[ie,k]=(0,I.useState)(),[ae,oe]=(0,I.useState)(!1),[A,ce]=(0,I.useState)(null),[le,fe]=(0,I.useState)(0),[me,he]=(0,I.useState)(null),[ge,M]=(0,I.useState)(`board`),_e=(0,I.useRef)(null),N=(0,I.useMemo)(()=>ve(t),[t]),Ce=u?.tasks.find(e=>e.id===D)??null,we=(0,I.useMemo)(()=>{let e=new Set;for(let t of i.values())t.status===`running`&&(e.add(t.id),e.add(t.name));return e},[i]),F=(0,I.useMemo)(()=>{let e=new Set;n&&e.add(n);for(let t of x)e.add(t);for(let t of i.values())t.status===`running`&&t.sessionId&&e.add(t.sessionId);return[...e]},[i,x,n]),Ee=e=>e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&F.includes(e.slice(8)))===!0,De=a.filter(Ee),Oe=a.filter(e=>!Ee(e)),ke=(0,I.useMemo)(()=>u?Me(u,{now:Date.now(),liveAgentIdentities:we,requireDueDate:u.lifecycle?.mode===`managed`}):null,[u,we]),je=(0,I.useMemo)(()=>u?u.tasks.filter(e=>e.status===`in_progress`||e.assignment?.status===`running`||e.assignment?.status===`queued`).reduce((e,t)=>e+(t.costCeilingUsd??0),0):0,[u]),L=(e,t={})=>{h(!0),N.send({type:e,payload:t})},Ne=(e,t={})=>{N.send({type:e,payload:t})},Pe=(0,I.useMemo)(()=>pn(u),[u]),R=(e=y)=>L(`kanban.list`,{page:e,pageSize:ln,activeSessionIds:F}),z=(e=l)=>{e&&L(`kanban.get`,{boardId:e})};(0,I.useEffect)(()=>{R()},[]),(0,I.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch(`/api/sessions`);if(!t.ok)return;let n=await t.json();if(!Array.isArray(n)||e)return;let r=n.filter(e=>!!e&&typeof e==`object`&&typeof e.sessionId==`string`&&e.status!==`lost`).map(e=>e.sessionId).sort();S(e=>e.length===r.length&&e.every((e,t)=>e===r[t])?e:r)}catch{}};t();let n=window.setInterval(t,8e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,I.useEffect)(()=>{let e=n?a.find(e=>e.tags?.includes(`session:${n}`)):void 0,t=!!(n&&e)&&_e.current!==n,r=t?e:l?void 0:a[0];r?.id&&(t&&(_e.current=n),g(r.id),L(`kanban.get`,{boardId:r.id}))},[a,l,n,g]),(0,I.useEffect)(()=>{u&&D&&!u.tasks.some(e=>e.id===D)&&O(null)},[u,D]),(0,I.useEffect)(()=>{l&&(L(`kanban.health`,{boardId:l}),L(`kanban.supervisor.status`,{boardId:l}))},[l]),(0,I.useEffect)(()=>{if(!l)return;let e=setInterval(()=>{N.send({type:`kanban.get`,payload:{boardId:l}}),N.send({type:`kanban.health`,payload:{boardId:l}})},5e3);return()=>clearInterval(e)},[l,N]),(0,I.useEffect)(()=>{let e=setInterval(()=>{N.send({type:`kanban.list`,payload:{page:y,pageSize:ln,activeSessionIds:F}})},8e3);return()=>clearInterval(e)},[F,y,N]);let Fe=e=>{b(e),g(null),R(e)};(0,I.useEffect)(()=>{k(void 0)},[l,D]),(0,I.useEffect)(()=>{if(!l||!D)return;let e=l,t=D;oe(!0),ce(null);let n=N.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){ce(r.error??`Task activity could not be loaded.`),oe(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(re(r.data.events??[]),k(r.data.presence??[]),oe(!1))});return N.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:cn}}),n},[l,D,Ce?.updatedAt,le,N]),(0,I.useEffect)(()=>{if(!(!l||!D))return N.on.bind(N)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===l&&t.taskId===D&&fe(e=>e+1)})},[l,D,N]);let Ie=()=>{let e=_.trim();e&&(v(``),L(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Le=()=>{if(!u)return;let e=C.trim();e&&(w(``),L(`kanban.task.add`,{boardId:u.id,title:e,columnId:u.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>z(u.id),150))},Re=()=>{if(!u)return;let e=ee.trim();e&&(E(``),L(`kanban.column.add`,{boardId:u.id,title:e}),window.setTimeout(()=>z(u.id),150))},ze=()=>{u&&(L(`kanban.delete`,{boardId:u.id}),window.setTimeout(R,150))},Be=()=>{u&&(L(`kanban.duplicate`,{boardId:u.id,title:`${u.title} Copy`}),window.setTimeout(R,150))},Ve=e=>{u&&(L(`kanban.task.remove`,{boardId:u.id,taskId:e.id}),window.setTimeout(()=>z(u.id),150))},B=(e,t)=>{if(!u)return;let n=u.tasks.find(t=>t.id===e),r=u.columns.find(e=>e.id===n?.columnId)?.title,i=u.columns.find(e=>e.id===t)?.title??t;L(`kanban.task.move`,{boardId:u.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>z(u.id),150)};return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,W.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,W.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,W.jsx)(`button`,{type:`button`,title:`Back`,onClick:e,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,W.jsx)(pe,{size:16})}),(0,W.jsx)(se,{size:17,className:`text-primary`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Kanban`}),(0,W.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[o,` boards · `,s,` active · `,c,` orphaned`]})]}),(0,W.jsx)(`button`,{type:`button`,title:`Refresh`,onClick:()=>R(),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,W.jsx)(de,{size:15,className:d?`animate-spin`:void 0})})]}),(0,W.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,W.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()},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,W.jsx)(`button`,{type:`button`,title:`Create board`,onClick:Ie,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,W.jsx)(te,{size:16})})]}),(0,W.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[De.length>0&&(0,W.jsxs)(`div`,{className:`mb-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-success`,children:[`Active session · `,s]}),De.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),L(`kanban.get`,{boardId:e.id})},className:P(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,l===e.id?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success`}),e.taskCount,` tasks`]}),(0,W.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id)),Oe.length>0&&(0,W.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 · `,c]}),Oe.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),L(`kanban.get`,{boardId:e.id})},className:P(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,l===e.id?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,W.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/45`}),e.taskCount,` tasks`]}),(0,W.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id))]}),(0,W.jsx)(Te,{page:y,pageSize:ln,totalItems:o,onPageChange:Fe,compact:!0,itemLabel:`boards`})]}),(0,W.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,W.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,W.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:u?.title??`No board selected`}),(0,W.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:u?`${u.columns.length} columns / ${u.tasks.length} tasks`:`Create or select a board`})]}),u&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`input`,{value:C,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Le()},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,W.jsx)(`button`,{type:`button`,title:`Add task`,onClick:Le,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,W.jsx)(te,{size:16})}),(0,W.jsx)(`input`,{value:ee,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Re()},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,W.jsx)(`button`,{type:`button`,title:`Add column`,onClick:Re,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,W.jsx)(se,{size:16})}),(0,W.jsx)(`button`,{type:`button`,title:`Duplicate board`,onClick:Be,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,W.jsx)(ue,{size:16})}),(0,W.jsx)(`button`,{type:`button`,title:`Delete board`,onClick:ze,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,W.jsx)(r,{size:16})})]})]}),u&&(0,W.jsx)(dn,{presence:u.presence}),u&&(0,W.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,W.jsx)(rt,{title:`Board boundary`,value:u.boundary,onSave:e=>{L(`kanban.update`,{boardId:u.id,boundary:e}),window.setTimeout(()=>z(u.id),150)}})}),u&&Pe&&(0,W.jsx)(hn,{runLink:Pe,sendRaw:Ne}),u&&!Pe&&u.tasks.length>0&&(0,W.jsx)(gn,{boardId:u.id,sendKanban:L}),u&&(0,W.jsx)(fn,{board:u,snapshot:m,sendKanban:L}),ke&&(0,W.jsx)(et,{audit:ke,onSelectTask:O}),u&&(0,W.jsx)(st,{board:u,sendKanban:L,onSelectTask:O}),u&&(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-4 py-1.5`,children:[[`board`,`Board`],[`tree`,`Tree`],[`dashboard`,`Verification`]].map(([e,t])=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>M(e),className:P(`rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors`,ge===e?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted`),children:t},e))}),f&&(0,W.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,W.jsx)(j,{size:15}),(0,W.jsx)(`span`,{className:`truncate`,children:f})]}),(0,W.jsx)(`div`,{ref:T,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:u?(0,W.jsxs)(W.Fragment,{children:[p&&(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground`,children:`Queue health`}),p.counts.ready>0&&(0,W.jsxs)(`span`,{title:`Claimable tasks`,className:`inline-flex items-center gap-1 text-success`,children:[p.counts.ready,` ready`]}),p.counts.running>0&&(0,W.jsxs)(`span`,{title:`Running assignments`,className:`inline-flex items-center gap-1 text-warning`,children:[p.counts.running,` running`]}),p.counts.review>0&&(0,W.jsxs)(`span`,{title:`In review`,className:`inline-flex items-center gap-1 text-primary`,children:[p.counts.review,` review`]}),p.counts.blocked>0&&(0,W.jsxs)(`span`,{title:`Manually blocked`,className:`inline-flex items-center gap-1 text-destructive`,children:[p.counts.blocked,` blocked`]}),p.counts.failed>0&&(0,W.jsxs)(`span`,{title:`Failed tasks`,className:`inline-flex items-center gap-1 text-destructive`,children:[p.counts.failed,` failed`]}),p.dependencyBlocked.count>0&&(0,W.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:[p.dependencyBlocked.count,` blocked by deps`]}),p.staleAssignments.count>0&&(0,W.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:[p.staleAssignments.count,` stale`]}),p.heartbeatDue.count===0&&p.staleAssignments.count===0&&p.dependencyBlocked.count===0&&(0,W.jsx)(`span`,{className:`text-success`,children:`healthy`}),je>0&&(0,W.jsxs)(`span`,{title:`Sum of costCeilingUsd for running/queued tasks`,className:`inline-flex items-center gap-1 text-info`,children:[`~$`,je.toFixed(2),` running cost`]})]}),ge===`tree`?(0,W.jsx)(pt,{board:u,selectedTaskId:D,onSelectTask:O}):ge===`dashboard`?(0,W.jsx)(gt,{board:u,onSelectTask:O}):(0,W.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...u.columns].sort((e,t)=>e.order-t.order).map(e=>(0,W.jsx)(yn,{board:u,column:e,selectedTaskId:D,dragTaskId:me,setDragTaskId:he,onSelectTask:O,onDeleteTask:Ve,onMoveTask:B},e.id))})]}):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No kanban board selected.`})})]}),(0,W.jsx)(Sn,{boards:a,board:u,task:Ce,runLink:Pe,onClose:()=>O(null),onSelectTask:O,sendKanban:L,sendRaw:Ne,refreshBoard:z,activityEvents:ne,activityPresence:ie,activityLoading:ae,activityError:A,activitySessionId:u?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>fe(e=>e+1)})]})}function hn({runLink:e,sendRaw:t}){let n=e.engine===`sdd`,r=n?`sdd.board`:`goal`,i=N(e=>e.setCurrentView),a=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,W.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,W.jsx)(fe,{size:11}),` `,e.engine]}),(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Live run — steer it from here`}),n&&(0,W.jsxs)(`button`,{type:`button`,className:a,title:`Open the live run view (SDD Hub)`,onClick:()=>i(`sddhub`),children:[(0,W.jsx)(fe,{size:12}),` Open live run`]}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,W.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`${r}.pause`),children:[(0,W.jsx)(T,{size:12}),` Pause`]}),(0,W.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`${r}.resume`),children:[(0,W.jsx)(ie,{size:12}),` Resume`]}),n&&(0,W.jsxs)(`button`,{type:`button`,className:a,onClick:()=>t(`sdd.board.retry_all_failed`),children:[(0,W.jsx)(le,{size:12}),` Retry failed`]}),(0,W.jsxs)(`button`,{type:`button`,className:P(a,`text-destructive hover:bg-destructive/10`),onClick:()=>t(`${r}.stop`),children:[(0,W.jsx)(p,{size:12}),` Stop`]})]})]})}function gn({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,W.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,W.jsx)(fe,{size:13,className:`text-primary`}),(0,W.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Run this board as a live agent job:`}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:`Start as Goal`}),(0,W.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:`Start as SDD`})]})]})}function _n({runLink:e,runTaskId:t,modelCandidates:n,sendRaw:r}){let i=e.engine===`sdd`,[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(``),l=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,u=()=>{let e=s.trim();e&&(r(i?`sdd.board.reassign`:`goal.assignTask`,{taskId:t,agentName:e}),o(!1),c(``))};return(0,W.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Run controls`}),i&&(0,W.jsxs)(`div`,{className:`mb-2`,children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Worker model`}),(0,W.jsx)(we,{candidates:n,placeholder:`Set model for this task…`,onPick:(e,n)=>r(`sdd.board.set_task_model`,{taskId:t,model:e,provider:n})})]}),a?(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u(),e.key===`Escape`&&o(!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,W.jsx)(`button`,{type:`button`,onClick:u,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,W.jsx)(h,{size:14})}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,W.jsx)(j,{size:14})})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,className:l,onClick:()=>r(i?`sdd.board.retry`:`goal.retryTask`,{taskId:t}),children:[(0,W.jsx)(le,{size:13}),` Retry`]}),(0,W.jsxs)(`button`,{type:`button`,className:l,onClick:()=>o(!0),children:[(0,W.jsx)(oe,{size:13}),` Reassign`]}),i?(0,W.jsxs)(`button`,{type:`button`,className:P(l,`text-destructive hover:bg-destructive/10`),onClick:()=>r(`sdd.board.cancel_task`,{taskId:t}),children:[(0,W.jsx)(p,{size:13}),` Cancel`]}):(0,W.jsxs)(`button`,{type:`button`,className:l,onClick:()=>r(`goal.runTask`,{taskId:t}),children:[(0,W.jsx)(ie,{size:13}),` Run now`]})]})]})}function vn(e,t,n){let r=t.assignment,i=an(e,t,[]).findings.filter(e=>e.category===`operational`),a=U(r?.provider),o=U(r?.model);return{owner:U(r?.name)??U(r?.agentId)??U(r?.role)??U(t.assignee)??U(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:Ye(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 yn({board:e,column:t,selectedTaskId:n,dragTaskId:i,setDragTaskId:a,onSelectTask:o,onDeleteTask:s,onMoveTask:c}){let l=Se(e=>e.verificationActivity),u=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,W.jsxs)(`section`,{className:P(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,u.length===0?`w-[180px]`:`w-[310px]`),children:[(0,W.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,W.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,W.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,W.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:u.length})]}),(0,W.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`&&i&&c(i,t.id),a(null)},children:u.map(t=>{let i=vn(e,t,l);return(0,W.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&a(t.id)},onDragEnd:()=>a(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,W.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>o(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,W.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(t.atomic||i.atomicityVerdict)&&(0,W.jsx)(`span`,{className:P(`shrink-0 rounded px-1 py-0.5 text-[10px] font-medium`,i.atomicityVerdict===`needs_decomposition`?`bg-destructive/15 text-destructive`:i.atomicityVerdict===`composite`?`bg-info/15 text-info`:i.atomicityVerdict===`borderline`||t.atomic?`bg-warning/15 text-warning`:`bg-muted text-muted-foreground`),title:i.atomicityVerdict?`Atomicity: ${i.atomicityVerdict}`:`Atomic task (subtree verification required)`,children:t.atomic?`atomic`:i.atomicityVerdict===`needs_decomposition`?`split me`:i.atomicityVerdict}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title})]}),t.description&&(0,W.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,W.jsx)(`button`,{type:`button`,title:`Delete task`,"aria-label":`Delete task: ${t.title}`,onClick:()=>s(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,W.jsx)(r,{size:14})})]}),(0,W.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,W.jsx)(`span`,{className:On(t.priority),children:t.priority}),(0,W.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),i.owner!==`Unassigned`&&(0,W.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:i.owner}),t.assignment&&(0,W.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:i.route}),t.assignment?.attempt?(0,W.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,i.attempts]}):null,i.fallbackCount>0&&(0,W.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[i.fallbackCount,` fallback`]}),i.blockers>0?(0,W.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[i.blockers,` blocker`]}):null,i.activeUsers>0&&(0,W.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[i.activeUsers,` active`]}),i.failed&&(0,W.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:`run failed`}),i.criticalRisks>0&&(0,W.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[i.criticalRisks,` critical risk`]}),i.warningRisks>0&&(0,W.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[i.warningRisks,` warning`]}),t.chain&&(0,W.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,W.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[t.assignment.skills.length,` skills`]}):null,i.verification!==`unverified`&&(0,W.jsxs)(`span`,{className:P(`rounded px-1.5 py-0.5`,i.verification===`passed`?`bg-success/10 text-success`:i.verification===`failed`?`bg-destructive/10 text-destructive`:`bg-warning/10 text-warning`),children:[`✓ `,i.verification]}),i.subtaskCounts&&(0,W.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[i.subtaskCounts.done,`/`,i.subtaskCounts.total,` subtasks`]}),i.evidenceCount>0&&(0,W.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:[i.evidenceCount,` evidence`]}),i.pendingDecomposition&&(0,W.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:`split pending approval`})]})]},t.id)})})]})}var bn=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],xn=[{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 Sn({boards:e,board:t,task:n,runLink:r,onClose:i,onSelectTask:o,sendKanban:s,sendRaw:c,refreshBoard:p,activityEvents:g,activityPresence:v,activityLoading:y,activityError:b,activitySessionId:x,refreshActivity:S}){let[C,w]=(0,I.useState)(``),[T,ee]=(0,I.useState)(``),[E,D]=(0,I.useState)(``),[O,ne]=(0,I.useState)(``),[re,ie]=(0,I.useState)(``),[k,ae]=(0,I.useState)(`session`),[A,se]=(0,I.useState)(``),[ce,le]=(0,I.useState)([]),[de,fe]=(0,I.useState)([]),[pe,me]=(0,I.useState)([]),[he,ge]=(0,I.useState)([]),[M,_e]=(0,I.useState)(``),N=Ce(!!n),ve=ke(!!n),ye=U(ve.sessionProvider),be=U(ve.sessionModel),xe=Ee(`kanban-task-inspector`,!!n),[Se,Te]=(0,I.useState)(!1),[F,De]=(0,I.useState)(!1),[Oe,Ae]=(0,I.useState)(``),[je,L]=(0,I.useState)(``),[Me,Ne]=(0,I.useState)(``),[Pe,R]=(0,I.useState)(`pending`),[z,Fe]=(0,I.useState)(``),[Ie,Le]=(0,I.useState)(``),[Re,ze]=(0,I.useState)(``),[Be,Ve]=(0,I.useState)(`medium`),[B,He]=(0,I.useState)(`chore`),[V,Ue]=(0,I.useState)(``),[We,Ge]=(0,I.useState)([]),[H,Ke]=(0,I.useState)([]),[qe,Je]=(0,I.useState)(!1),[Ye,Xe]=(0,I.useState)(``),[Ze,Qe]=(0,I.useState)(``),[$e,et]=(0,I.useState)(`off`),[tt,nt]=(0,I.useState)(``),[it,at]=(0,I.useState)(``),[ot,st]=(0,I.useState)(``),[ct,lt]=(0,I.useState)(``),[dt,ft]=(0,I.useState)(``),[pt,mt]=(0,I.useState)(`observation`),[ht,gt]=(0,I.useState)(`unknown`),[_t,K]=(0,I.useState)(``);(0,I.useEffect)(()=>{let r=U(n?.assignment?.provider),i=U(n?.assignment?.model);w(U(n?.assignment?.agentId)??U(n?.assignedAgent)??``),ee(U(n?.assignment?.name)??``),D(U(n?.assignment?.role)??``),ne(r??``),ie(i??``),ae(n?.assignment?.modelRouting??(r||i?`fixed`:`session`)),se(U(n?.assignment?.fallbackProfile)??``),le(n?.assignment?.fallbackModels??[]),fe(n?.assignment?.skills??[]),me(n?.assignment?.tools??[]),ge(n?.assignment?.allowedCapabilities??[]),_e(e.find(e=>e.id!==t?.id)?.id??``),Ae(n?.title??``),L(n?.description??``),Ne(n?.dueDate??``),R(n?.status??`pending`),Fe(``),Le(``),ze(``),Ve(n?.priority??`medium`),He(n?.type??`chore`),Ue(n?.labels?.join(`, `)??``),Ge(n?.dependsOn??[]),Ke(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]:[]),Je(!1),Xe(n?.estimatedHours?.toString()??``),Qe(n?.actualHours?.toString()??``),et(n?.retryPolicy??n?.assignment?.retryPolicy??`off`),nt((n?.costCeilingUsd??n?.assignment?.costCeilingUsd)?.toString()??``),at(n?.assignment?.maxAttempts?.toString()??``),st(``),lt(``),ft(``),mt(`observation`),gt(`unknown`),K(``)},[t?.id,e,n]);let q=e=>({boardId:t?.id,taskId:n?.id,...C.trim()?{agentId:C.trim()}:{},...T.trim()?{name:T.trim()}:{},...E.trim()?{role:E.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:ce,skills:de,tools:pe,allowedCapabilities:he,...it?{maxAttempts:Number(it)}:{},...tt?{costCeilingUsd:Number(tt)}:{},retryPolicy:$e,activityNote:_t.trim()||`${e===`dispatch`?`Dispatched`:`Assigned`} from WebUI to ${T.trim()||C.trim()||E.trim()||`the configured agent route`}.`}),J=()=>{!t||!n||!Oe.trim()||(s(`kanban.task.update`,{boardId:t.id,taskId:n.id,title:Oe.trim(),description:je,dueDate:Me||null,...t.lifecycle?.mode===`managed`?{}:{status:Pe},priority:Be,type:B,labels:V.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:We,...n.chain&&H.length<=1?{chain:null}:{},estimatedHours:Ye?Number(Ye):0,actualHours:Ze?Number(Ze):0,retryPolicy:$e,costCeilingUsd:tt?Number(tt):null,activityNote:_t.trim()||`Task contract edited in WebUI.`}),H.length>1&&s(`kanban.task.chain`,{boardId:t.id,taskIds:H,enforceDependencies:qe}),window.setTimeout(()=>p(t.id),180),K(``))},vt=[`backlog`,`todo`,`running`,`review`,`done`],yt=n?.lifecycle?.currentStage,bt=yt?vt.indexOf(yt):-1,xt=bt>=0&&bt<vt.length-1?vt[bt+1]:void 0,St=()=>{!t||!n||!xt||!z.trim()||(s(`kanban.task.transition`,{boardId:t.id,taskId:n.id,to:xt,actor:C.trim()||T.trim()||n.assignee||n.assignedAgent||`webui-agent`,comment:z.trim(),...Ie.trim()?{action:Ie.trim()}:{},...Re.trim()?{attachment:{url:Re.trim(),type:`url`,title:`Evidence for ${n.title}`}}:{}}),window.setTimeout(()=>p(t.id),180))},Ct=()=>{!t||!n||!ot.trim()||(s(`kanban.task.check.add`,{boardId:t.id,taskId:n.id,description:ot.trim(),checkType:`manual`}),st(``))},wt=()=>{!t||!n||!ct.trim()||(s(`kanban.task.activity.add`,{boardId:t.id,taskId:n.id,kind:pt,outcome:ht,summary:ct.trim(),...dt.trim()?{details:dt.trim()}:{},actor:T.trim()||C.trim()||`webui-operator`}),lt(``),ft(``),window.setTimeout(S,150))};return n?(0,W.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,W.jsxs)(`div`,{className:P(`flex h-12 items-center gap-2 border-b px-3`,F&&`px-5`),children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Task`}),(0,W.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:n.id.slice(0,8)})]}),(0,W.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:()=>De(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,W.jsx)(f,{size:16}):(0,W.jsx)(d,{size:16})}),(0,W.jsx)(`button`,{type:`button`,title:`Close`,onClick:()=>{De(!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,W.jsx)(j,{size:16})})]}),n?(0,W.jsxs)(`div`,{ref:xe,className:P(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,F&&`px-5 py-4 xl:px-7`),children:[(0,W.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,W.jsx)(rt,{title:`Task boundary`,value:n.boundary,inherited:t?.boundary,onSave:e=>{t&&(s(`kanban.task.update`,{boardId:t.id,taskId:n.id,boundary:e,activityNote:`Task boundary edited in WebUI.`}),window.setTimeout(()=>p(t.id),150))}}),(0,W.jsx)(Q,{label:`Title`,value:Oe,onChange:Ae}),(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Description / working context`}),(0,W.jsx)(`textarea`,{value:je,onChange:e=>L(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,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,W.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,W.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Managed stage`}),(0,W.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:n.lifecycle?.currentStage??`Backlog`})]}):(0,W.jsx)($,{label:`Status`,value:Pe,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>R(e)}),(0,W.jsx)($,{label:`Priority`,value:Be,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Ve(e)}),(0,W.jsx)($,{label:`Type`,value:B,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>He(e)}),(0,W.jsx)(Q,{label:`Labels (comma separated)`,value:V,onChange:Ue})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsx)(Q,{label:`Due date (ISO or YYYY-MM-DD)`,value:Me,onChange:Ne}),(0,W.jsx)(Q,{label:`Estimated hours`,value:Ye,onChange:Xe}),(0,W.jsx)(Q,{label:`Actual hours`,value:Ze,onChange:Qe})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Dependencies`}),(0,W.jsx)(G,{options:(t?.tasks??[]).filter(e=>e.id!==n.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:We,onChange:Ge,placeholder:`Select blocking tasks…`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Task chain (selection order)`}),(0,W.jsx)(G,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:H,onChange:e=>Ke(e.includes(n.id)?e:[n.id,...e]),placeholder:`Add tasks to a sequential chain…`}),(0,W.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:qe,onChange:e=>Je(e.target.checked)}),`Enforce chain order as dependencies`]})]}),(0,W.jsx)(Q,{label:`Change / assignment reason (persisted to activity)`,value:_t,onChange:K}),(0,W.jsxs)(`button`,{type:`button`,onClick:J,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,W.jsx)(_,{size:15}),` Save task contract`]}),t?.lifecycle?.mode===`managed`&&xt&&(0,W.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,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Kanban Agent transition`}),(0,W.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[yt,` → `,xt,`; no stages can be skipped.`]})]}),(0,W.jsx)(l,{size:16,className:`text-primary`})]}),(0,W.jsx)(Q,{label:`Completed action / reviewer action`,value:Ie,onChange:Le}),(0,W.jsx)(Q,{label:`Truthful progress comment (required)`,value:z,onChange:Fe}),(0,W.jsx)(Q,{label:`Evidence attachment URL`,value:Re,onChange:ze}),(0,W.jsxs)(`button`,{type:`button`,disabled:!z.trim(),onClick:St,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,W.jsx)(a,{size:15}),` Advance to `,xt]})]})]}),t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ut,{board:t,task:n,events:g,presence:v,sessionId:x,sessionProvider:ye,sessionModel:be}),(0,W.jsx)(Ft,{task:n,events:g,sessionId:x}),(0,W.jsx)(sn,{board:t,task:n,events:g})]}),(0,W.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,W.jsx)(Dn,{label:`Source`,value:n.origin?.system??`manual`}),(0,W.jsx)(Dn,{label:`Task ID`,value:n.id.slice(0,8)}),(0,W.jsx)(Dn,{label:`Run`,value:n.assignment?.status??`unassigned`}),(0,W.jsx)(Dn,{label:`Column`,value:Cn(t,n.columnId)})]}),n.assignment&&(0,W.jsx)(En,{assignment:n.assignment}),r&&n.origin?.taskId&&(0,W.jsx)(_n,{runLink:r,runTaskId:n.origin.taskId,modelCandidates:N,sendRaw:c}),!r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,W.jsx)($,{label:`Primary model source`,value:k,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>ae(e)}),k===`session`&&(0,W.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: `,ye?`${ye}/`:``,be||`not available`,`.`]}),k===`fixed`&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,W.jsx)(we,{value:re||void 0,provider:O||void 0,candidates:N,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{ie(e),ne(t)}})]}),k===`fallback_profile`&&(0,W.jsx)($,{label:`Fallback profile (first model is primary)`,value:A,options:Object.keys(ve.fallbackProfiles),placeholder:`Select configured profile…`,onChange:se}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fallback models`}),(0,W.jsx)(G,{options:N.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:ce,onChange:le,placeholder:`Add fallback model…`,emptyLabel:`No models — add a provider in Settings`})]}),(0,W.jsx)($,{label:`Role`,value:E,options:bn,placeholder:`Select a role…`,onChange:D}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,W.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· force-loaded into the worker`})]}),(0,W.jsx)(G,{options:ve.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:de,onChange:fe,placeholder:`Assign required skills…`,emptyLabel:`No skills registered`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,W.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = full default toolset`})]}),(0,W.jsx)(G,{options:ve.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:pe,onChange:me,placeholder:`Restrict to specific tools…`,emptyLabel:`Tool list unavailable on this server`})]}),(0,W.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>Te(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,W.jsx)(m,{size:13,className:P(`transition-transform`,Se&&`rotate-180`)})]}),Se&&(0,W.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,W.jsx)(Q,{label:`Agent name (optional)`,value:T,onChange:ee}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsx)($,{label:`Retry policy`,value:$e,options:[`off`,`incremental`,`exponential`],onChange:e=>et(e)}),(0,W.jsx)(Q,{label:`Max attempts`,value:it,onChange:at}),(0,W.jsx)(Q,{label:`Cost ceiling USD`,value:tt,onChange:nt})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,W.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = safe defaults`})]}),(0,W.jsx)(G,{options:xn,selected:he,onChange:ge,placeholder:`Grant a capability…`})]})]})]})]}),(0,W.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(s(`kanban.task.assign`,q(`assign`)),K(``),window.setTimeout(()=>p(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,W.jsx)(oe,{size:15}),`Assign`]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(s(`kanban.task.dispatch`,q(`dispatch`)),K(``),window.setTimeout(()=>p(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,W.jsx)(u,{size:15}),`Dispatch`]})]})]}),e.length>1&&!r?(0,W.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Target board`}),(0,W.jsx)(`select`,{value:M,onChange:e=>_e(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,W.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!M||s(`kanban.task.copy`,{boardId:t.id,taskId:n.id,targetBoardId:M})},disabled:!M,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,W.jsx)(ue,{size:15}),`Copy`]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!M||s(`kanban.task.transfer`,{boardId:t.id,taskId:n.id,targetBoardId:M})},disabled:!M,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,W.jsx)(a,{size:15}),`Transfer`]})]})]}):null,(0,W.jsxs)(`div`,{className:`mt-5`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Completion checks`}),(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(n.successCriteria??[]).map(e=>(0,W.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,W.jsx)(h,{size:13,className:e.status===`passed`?`text-success`:`text-muted-foreground`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e.description}),(0,W.jsx)(`select`,{value:e.status,onChange:r=>s(`kanban.task.check.update`,{boardId:t?.id,taskId:n.id,checkId:e.id,status:r.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))})]},e.id)),(0,W.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,W.jsx)(`input`,{value:ot,onChange:e=>st(e.target.value),onKeyDown:e=>e.key===`Enter`&&Ct(),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,W.jsx)(`button`,{type:`button`,onClick:Ct,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,W.jsx)(te,{size:14})})]})]})]}),t&&(0,W.jsx)(en,{boardId:t.id,task:n,sendKanban:s}),t&&(0,W.jsx)(ut,{board:t,task:n,sendKanban:s,onSelectTask:o}),(0,W.jsx)(Et,{task:n,events:g,sessionId:x,loading:y,error:b,onRefresh:S}),(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Record decision / outcome`}),(0,W.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,W.jsx)(`select`,{value:pt,onChange:e=>mt(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,W.jsx)(`option`,{value:e,children:e},e))}),(0,W.jsx)(`select`,{value:ht,onChange:e=>gt(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,W.jsx)(`option`,{value:e,children:e},e))})]}),(0,W.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,W.jsx)(`input`,{value:ct,onChange:e=>lt(e.target.value),onKeyDown:e=>e.key===`Enter`&&wt(),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,W.jsx)(`button`,{type:`button`,onClick:wt,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":`Record task decision or outcome`,children:(0,W.jsx)(te,{size:14})})]}),(0,W.jsx)(`input`,{value:dt,onChange:e=>ft(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`})]})]}):null]}):null}function Cn(e,t){return e?.columns.find(e=>e.id===t)?.title??t}var wn={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 Tn(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 En({assignment:e}){let t=e.status===`running`,n=Tn(e.dispatchedAt,e.completedAt),r=U(e.name)??U(e.agentId),i=U(e.role),a=U(e.provider),o=U(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,W.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[a?`${a}/`:``,o??`—`]})}),e.subagentId&&s.push({label:`Subagent`,value:(0,W.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,W.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Live run`}),(0,W.jsxs)(`span`,{className:P(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,wn[e.status]??`bg-muted text-muted-foreground`),children:[t&&(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),s.length>0&&(0,W.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:s.map(e=>(0,W.jsxs)(`div`,{className:`contents`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,W.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Last result`}),(0,W.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,W.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 Dn({label:e,value:t}){return(0,W.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,W.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function Q({label:e,value:t,onChange:n}){return(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,W.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 $({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,W.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,W.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]})]})}function On(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`}export{mn as KanbanView};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{
|
|
3
|
-
`),[o]),l=s.length>1;return(0,d.jsxs)(`div`,{className:`not-prose relative my-3 rounded-lg border border-border overflow-hidden group/codeblock`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1 border-b border-border text-xs`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-B8C0AAAG.js","assets/rolldown-runtime-QTnfLwEv.js","assets/monaco-C7izDJhg.js","assets/monaco-Br_kD0ds.css","assets/markdown-L6DLSM7f.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Pi as t,Wr as n,da as r,ga as i,oi as a,tt as o}from"./vendor-B8C0AAAG.js";import"./i18n-Cjk0Ya0G.js";import{s}from"./monaco-C7izDJhg.js";import{t as c}from"./utils-YTsIExHc.js";import{d as l}from"./markdown-L6DLSM7f.js";var u=e(i(),1),d=o();async function f(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function p(e,t){if(typeof document>`u`)return;let n=new Blob([t],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(r),1e3)}function m(e){let t=(e??``).toLowerCase();return/bash|shell|exec|run/.test(t)?`log`:(/grep|search|find/.test(t),`txt`)}function h(e){return e<1e3?`${e} ms`:e<6e4?`${(e/1e3).toFixed(e<1e4?2:1)}s`:`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`}function g(e){if(!e)return;let t=e.match(/(?:^|\n)\s*(?:\[?exit(?:\s*code)?\]?\s*[:=]?\s*)(\d+)\s*$/i);return t?Number(t[1]):void 0}var _=[l];function v(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(v).join(``):(0,u.isValidElement)(e)?v(e.props.children):``}function y({text:e}){let{t:n}=r(),[i,o]=(0,u.useState)(!1);return(0,d.jsxs)(`button`,{type:`button`,onClick:(0,u.useCallback)(async()=>{await f(e)&&(o(!0),setTimeout(()=>o(!1),1500))},[e]),className:c(`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] transition-colors`,`hover:bg-muted-foreground/10`,i?`text-success`:`text-muted-foreground hover:text-foreground`),title:n(i?`common:action.copied`:`common:action.copy`),children:[i?(0,d.jsx)(t,{className:`h-3 w-3`}):(0,d.jsx)(a,{className:`h-3 w-3`}),(0,d.jsx)(`span`,{children:n(i?`common:action.copied`:`common:action.copy`)})]})}var b={code({inline:e,className:t,children:r,...i}){let a=/language-(\w+)/.exec(t??``),o=v(r).replace(/\n$/,``);if(e||!a)return(0,d.jsx)(`code`,{className:c(`rounded border border-border/60 px-1.5 py-0.5 text-[0.85em] font-mono`,t),...i,children:r});let s=(0,u.useMemo)(()=>o.split(`
|
|
3
|
+
`),[o]),l=s.length>1;return(0,d.jsxs)(`div`,{className:`not-prose relative my-3 rounded-lg border border-border overflow-hidden group/codeblock`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1 border-b border-border text-xs`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(n,{className:`h-3 w-3 text-muted-foreground`}),(0,d.jsx)(`span`,{className:`font-mono text-muted-foreground font-medium`,children:a[1]}),s.length>0&&(0,d.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/75 tabular-nums`,children:[s.length,` line`,s.length===1?``:`s`]})]}),(0,d.jsx)(y,{text:o})]}),l?(0,d.jsxs)(`div`,{className:`flex max-h-[40rem] overflow-auto`,children:[(0,d.jsx)(`pre`,{"aria-hidden":!0,className:`text-xs font-mono leading-[1.55] py-3 pl-3 pr-2 text-muted-foreground/65 select-none border-r border-border/30 tabular-nums text-right shrink-0`,children:s.map((e,t)=>(0,d.jsx)(`div`,{children:t+1},t))}),(0,d.jsx)(`pre`,{className:`overflow-x-auto py-3 px-3 text-xs leading-[1.55] font-mono flex-1`,children:(0,d.jsx)(`code`,{className:c(`hljs`,t),...i,children:r})})]}):(0,d.jsx)(`pre`,{className:`overflow-x-auto p-3 text-xs leading-relaxed font-mono max-h-[40rem]`,children:(0,d.jsx)(`code`,{className:c(`hljs`,t),...i,children:r})}),(0,d.jsx)(`div`,{className:`pointer-events-none absolute bottom-8 left-0 right-0 h-8 opacity-0 group-hover/codeblock:opacity-100 transition-opacity`,style:{background:`linear-gradient(to top, hsl(var(--foreground) / 0.08), transparent)`}})]})}},x=(0,u.lazy)(()=>s(()=>import(`./vendor-B8C0AAAG.js`).then(e=>e.x),__vite__mapDeps([0,1,2,3,4,5])));function S(e){return(0,d.jsx)(u.Suspense,{fallback:null,children:(0,d.jsx)(x,{...e})})}export{m as a,_ as c,g as i,f as n,h as o,p as r,b as s,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Dt as t,Ei as n,Jt as r,Nn as i,Pr as a,Rn as o,Si as s,Un as c,Yt as l,an as u,da as d,ga as f,hr as p,ma as m,mi as h,mt as g,ot as _,qi as v,ta as y,tn as b,tt as x,vi as S}from"./vendor-B8C0AAAG.js";import"./i18n-Cjk0Ya0G.js";import{n as C}from"./ui-store-DPNSalc-.js";import{t as w}from"./utils-YTsIExHc.js";import{t as T}from"./mailbox-store-DC7x_eml.js";import{s as E}from"./view-navigation-CV5XT76I.js";import{s as D,t as O}from"./LazyMarkdown-Cpjlf6IL.js";import{t as k}from"./empty-state-DrJ4uVh8.js";var A=e(f(),1),j=x(),M={note:a,ask:s,assign:r,steer:b,btw:v,broadcast:r,status:S,result:n,review:l},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?m.t(`common:time.justNow`):n<36e5?m.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?m.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?m.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t}=d(),r=Object.entries(e);return r.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:r.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)(n,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:r}=d(),a=C(e=>e.selectedMailMessage),s=C(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{s(null)},[s]);function l(){s(null),E(`chat`)}if(!a)return(0,j.jsx)(k,{icon:(0,j.jsx)(o,{className:`h-6 w-6`}),title:r(`activity:mailbox.emptyDetail`),description:r(`activity:mailbox.emptyDetailHint`)});let f=M[a.type]??i,m=r(`activity:mailbox.type.${a.type}`,{defaultValue:a.type}),v=N[a.priority]??N.normal,b=a.scope?{scope:a.scope,recipientSessionId:a.recipientSessionId}:T(a.to),x=a.to===`*`||a.to===`all`?r(`activity:mailbox.everyone`):a.to,S=b.scope===`session`?r(`activity:mailbox.sessionScope`,{sid:b.recipientSessionId??``}):b.scope===`project`?r(`activity:mailbox.projectScope`):r(`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:l,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.backToChat`),children:(0,j.jsx)(y,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className: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)(f,{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)(n,{className:`h-3 w-3`}),r(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:w(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,v),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)(c,{className:`h-2.5 w-2.5`}),` `,r(`activity:mailbox.audienceLeaders`)]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground/80`,children:a.from}),(0,j.jsx)(`span`,{children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:x}),b.scope===`session`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-warning/12 text-warning`,title:r(`activity:mailbox.sessionScopeTitle`,{sid:b.recipientSessionId??``}),children:[(0,j.jsx)(c,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.sessionLabel`)]}),b.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)(p,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.projectLabel`)]}),(0,j.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(h,{className:`h-3 w-3`}),F(a.timestamp)]})]})]}),(0,j.jsx)(`button`,{type:`button`,onClick:l,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.closeTitle`),children:(0,j.jsx)(_,{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)(t,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:m})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:w(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,v),children:a.priority||`normal`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(g,{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:[b.scope===`session`?(0,j.jsx)(c,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(p,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:r(`activity:mailbox.scopeLabel`)}),(0,j.jsx)(`span`,{className:`truncate`,children:S})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(h,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:P(a.timestamp)})]}),a.replyTo&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:r(`activity:mailbox.replyTo`,{id:a.replyTo})})]}),a.completed&&a.completedBy&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(n,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:a.completedAt?r(`activity:mailbox.completedByAt`,{name:a.completedBy,time:P(a.completedAt)}):r(`activity:mailbox.completedBy`,{name:a.completedBy})})]}),a.outcome&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.outcome`)}),(0,j.jsx)(`span`,{children:a.outcome})]}),a.taskContext&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.task`)}),(0,j.jsx)(`span`,{children:a.taskContext})]})]}),Object.keys(a.readBy??{}).length>0&&(0,j.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,j.jsx)(I,{readBy:a.readBy})})]})]})})}export{L as MailboxDetailView};
|