@wrongstack/webui 0.292.1 → 0.295.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/assets/AgentRosterView-y-MCHghy.js +7 -0
- package/dist/assets/AnalyticsDashboard-tGlXeqV5.js +1 -0
- package/dist/assets/AudienceMemoryPanel-D45M-Fr6.js +3 -0
- package/dist/assets/ChangesView-Otr6kwYr.js +1 -0
- package/dist/assets/ChronicleDashboard-BvsfI25e.js +1 -0
- package/dist/assets/CodeEditor-DtD0-wwy.js +1 -0
- package/dist/assets/CodeMap-CVmu16Ec.js +1 -0
- package/dist/assets/ConfirmModal-C7H16wDN.js +1 -0
- package/dist/assets/{CronJobsPanel-CVXW2Y-n.js → CronJobsPanel-CT6XRgmQ.js} +1 -1
- package/dist/assets/{DebugDashboard-BldwPA32.js → DebugDashboard-DZy3VUpn.js} +1 -1
- package/dist/assets/DesignGalleryView-CQkuFsfj.js +1 -0
- package/dist/assets/{GoalView-p7f1544B.js → GoalView-CTqdYc-z.js} +1 -1
- package/dist/assets/KanbanView-DryFcAzY.js +3 -0
- package/dist/assets/{LazyMarkdown-C1a0wbAZ.js → LazyMarkdown-DWlQpo_8.js} +3 -3
- package/dist/assets/MailboxDetailView-CsI_6HsE.js +1 -0
- package/dist/assets/MemoryManager-D_bjR09v.js +1 -0
- package/dist/assets/{ModelPicker-Cwa4UKNc.js → ModelPicker-fGNsJUXK.js} +1 -1
- package/dist/assets/{OfficeMapPanel-B0j4e2O1.css → OfficeMapPanel-BFIF-EMt.css} +1 -1
- package/dist/assets/OfficeMapPanel-KRrwpmvi.js +4 -0
- package/dist/assets/ProcessMonitor-BtgVvQgx.js +1 -0
- package/dist/assets/{QueuePanel-lUChp6xi.js → QueuePanel-BGSxmdqf.js} +1 -1
- package/dist/assets/{RefreshDebugView-BNa6ehdH.js → RefreshDebugView-B_wCBpFb.js} +1 -1
- package/dist/assets/SddHub-BryXNdFd.js +2 -0
- package/dist/assets/SessionsDashboard-DLOhC9JZ.js +1 -0
- package/dist/assets/SetupScreen-DsXgzxA1.js +1 -0
- package/dist/assets/SkillDetailView-ChyQLtrl.js +3 -0
- package/dist/assets/{SpecsView-CNqNOKqo.js → SpecsView-Dh9YG8Id.js} +1 -1
- package/dist/assets/TechStackView-RJGVF44_.js +1 -0
- package/dist/assets/{TerminalPanel-KysALyRz.js → TerminalPanel-3rZfmUfb.js} +1 -1
- package/dist/assets/Toaster-BzC_AdG5.js +1 -0
- package/dist/assets/activity-7VmgGy-T.js +5 -0
- package/dist/assets/activity-BzwApar4.js +5 -0
- package/dist/assets/activity-CCUWlVKh.js +5 -0
- package/dist/assets/activity-DAHFiOfU.js +5 -0
- package/dist/assets/activity-DkkpH2Tf.js +5 -0
- package/dist/assets/activity-DqsX-GMs.js +5 -0
- package/dist/assets/{activity-Cyx4UukM.js → activity-t0PmZ94i.js} +3 -3
- package/dist/assets/{button-99L74zdE.js → button-GVbauxIJ.js} +1 -1
- package/dist/assets/{chat-store-Cunk1nDr.js → chat-store-BEcTB7SD.js} +7 -7
- package/dist/assets/{codemap-activity-store-BIW6YPvC.js → codemap-activity-store-DrrI6G7M.js} +1 -1
- package/dist/assets/{dialog-CNwwBFw3.js → dialog-BjPQYovj.js} +1 -1
- package/dist/assets/empty-state-DJc37Wg1.js +1 -0
- package/dist/assets/{i18n-DaR2GB_4.js → i18n-c37VNlP9.js} +2 -2
- package/dist/assets/index-196U0qsu.js +125 -0
- package/dist/assets/index-n_-BWskP.css +1 -0
- package/dist/assets/{input-DXjUO_X9.js → input-BVi5hYQz.js} +1 -1
- package/dist/assets/{mailbox-store-Dq1wxCRt.js → mailbox-store-DSvN5ZEo.js} +1 -1
- package/dist/assets/roster-ws-BD-ATeja.js +1 -0
- package/dist/assets/{session-store-B8icONBU.js → session-store-K_ozfq0o.js} +1 -1
- package/dist/assets/{settings-llUXRsji.js → settings-24NUQrlz.js} +1 -1
- package/dist/assets/settings-BcyGqyX3.js +1 -0
- package/dist/assets/settings-BhEHLxqK.js +1 -0
- package/dist/assets/settings-C67tfoiy.js +1 -0
- package/dist/assets/settings-CvkIXOQE.js +1 -0
- package/dist/assets/{settings-CyzkAhwD.js → settings-DGTQ4aKo.js} +1 -1
- package/dist/assets/settings-i7lxRYZu.js +1 -0
- package/dist/assets/shared-BQ9yQXDx.js +1 -0
- package/dist/assets/{stores-JSLvWOQY.js → stores-DVhvmaer.js} +1 -1
- package/dist/assets/ui-store-DxFtiYFb.js +1 -0
- package/dist/assets/useWebSocket-kb2VPjLc.js +28 -0
- package/dist/assets/{utils-C4qVQ63O.js → utils-DvgvNCoT.js} +1 -1
- package/dist/assets/{vendor-Di1mdAi5.js → vendor-BmsAdDhb.js} +27 -27
- package/dist/assets/{view-navigation-BbHlzAQz.js → view-navigation-D8lN47bJ.js} +1 -1
- package/dist/assets/ws-client-BydCS6yi.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.map +1 -1
- package/dist/components/ContextBreakdownModal.d.ts.map +1 -1
- package/dist/components/ContextDashboard.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/InspectorPanel.d.ts.map +1 -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 +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/SettingsPanel/BrainSection.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/OAuthLoginSection.d.ts +13 -7
- package/dist/components/SettingsPanel/OAuthLoginSection.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/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/SkillsList.d.ts.map +1 -1
- package/dist/components/SkillDetailView.d.ts.map +1 -1
- package/dist/components/TechStackView/index.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/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/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 +251 -0
- package/dist/index.css.map +2 -2
- package/dist/index.html +23 -24
- package/dist/index.js +13647 -9142
- 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/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 +31 -23
- 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 +107 -77
- package/dist/stores/local-prefs.d.ts +4 -3
- 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/types.d.ts +1 -1
- package/dist/stores/types.d.ts.map +1 -1
- package/dist/stores/ui-store.d.ts +3 -3
- 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 +364 -68
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/assets/AnalyticsDashboard-DM8YmJuy.js +0 -1
- package/dist/assets/AudienceMemoryPanel-BN1qR1rz.js +0 -3
- package/dist/assets/ChangesView-PgFw9vKk.js +0 -1
- package/dist/assets/ChronicleDashboard-CtOiFCYV.js +0 -1
- package/dist/assets/CodeEditor-B_KwrAhN.js +0 -1
- package/dist/assets/CodeMap-T1dsXVRH.js +0 -1
- package/dist/assets/ConfirmModal-Bm9f2Pg9.js +0 -1
- package/dist/assets/DesignGalleryView-CUi5RBHH.js +0 -1
- package/dist/assets/KanbanView-CD_x5YND.js +0 -2
- package/dist/assets/MailboxDetailView-DQpxIh_A.js +0 -1
- package/dist/assets/MemoryManager-BrCVqIJK.js +0 -1
- package/dist/assets/OfficeMapPanel-D01rqjLt.js +0 -4
- package/dist/assets/ProcessMonitor-DjO7eNsN.js +0 -1
- package/dist/assets/SddHub-DLVIXlN6.js +0 -2
- package/dist/assets/SessionsDashboard-DsAc_Sx2.js +0 -1
- package/dist/assets/SetupScreen-KqV61-Ir.js +0 -1
- package/dist/assets/SkillDetailView-CK7MB8Uo.js +0 -3
- package/dist/assets/TechStackView-nVNj4kWJ.js +0 -1
- package/dist/assets/Toaster-B1idXZ-O.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-Dyikq8Zm.js +0 -5
- package/dist/assets/activity-Ukyu3lON.js +0 -5
- package/dist/assets/activity-gaWDc806.js +0 -5
- package/dist/assets/index-BwEOo8R-.css +0 -1
- package/dist/assets/index-Du90vd1u.js +0 -119
- package/dist/assets/pagination-Ktuov5iD.js +0 -1
- package/dist/assets/settings-4BR882HN.js +0 -1
- package/dist/assets/settings-B5P4V9M6.js +0 -1
- package/dist/assets/settings-Cjxo5UVP.js +0 -1
- package/dist/assets/settings-CnViO4_M.js +0 -1
- package/dist/assets/settings-jrfJX8W2.js +0 -1
- package/dist/assets/shared-aSCYBzAV.js +0 -1
- package/dist/assets/ui-store-BepZz9CZ.js +0 -1
- package/dist/assets/useWebSocket-CRYUFxmO.js +0 -27
- package/dist/assets/ws-client-BWO_PH_X.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bt as t,Oi as n,Xr as r,aa as i,bn as a,ca as o,ot as s,qt as c,tt as l,ua as u}from"./vendor-BmsAdDhb.js";import"./i18n-c37VNlP9.js";import{t as d}from"./useWebSocket-kb2VPjLc.js";import{t as f}from"./utils-DvgvNCoT.js";import{s as p}from"./view-navigation-D8lN47bJ.js";import{y as m}from"./index-196U0qsu.js";var h=e(u(),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=l(),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,a]=(0,h.useState)(`light`),{t:o}=i(),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:()=>a(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:l}=d(),{t:u}=i(),[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(!l)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?o.t(`activity:design.wrote`,{path:t.path}):o.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},s=e=>{let t=e.payload;if(!t?.ok){N(o.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?o.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):o.t(`activity:design.verifyClean`,{files:t.filesScanned}))};return l.on(`design.list`,e),l.on(`design.use`,t),l.on(`design.set`,n),l.on(`design.tune`,r),l.on(`design.swap`,i),l.on(`design.materialize`,a),l.on(`design.verify`,s),l.send({type:`design.list`}),()=>{l.off(`design.list`,e),l.off(`design.use`,t),l.off(`design.set`,n),l.off(`design.tune`,r),l.off(`design.swap`,i),l.off(`design.materialize`,a),l.off(`design.verify`,s)}},[l]);let P=(0,h.useCallback)(e=>l?.send({type:`design.use`,payload:{kit:e,stack:w}}),[l,w]),F=(0,h.useCallback)((e,t)=>{x(n=>({...n,[e]:t})),l?.send({type:`design.set`,payload:{overrides:{[e]:t}}})},[l]),I=(0,h.useCallback)(e=>l?.send({type:`design.tune`,payload:{tune:e}}),[l]),L=(0,h.useCallback)(()=>{N(o.t(`activity:design.writing`)),l?.send({type:`design.materialize`,payload:{stack:w}})},[l,w]),R=(0,h.useCallback)(()=>{N(o.t(`activity:design.scanning`)),l?.send({type:`design.verify`})},[l]),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)(a,{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)(c,{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)(s,{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)(a,{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 i=v===e.id,a=i?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,i?`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,a,`light`),label:u(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,a,`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}),i&&(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)(n,{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`,i?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:u(i?`activity:design.reapply`:`activity:design.use`)}),i&&(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)(r,{className:`w-3 h-3`}),` `,u(`activity:design.materialize`)]}),i&&(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)(t,{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})]}),i&&(0,S.jsx)(D,{kit:e,overrides:a,onSet:F}),i&&(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-Cunk1nDr.js";import{$t as n,Bn as r,Mt as i,Xt as a,Zn as o,aa as s,at as c,ci as l,cn as u,ea as d,en as f,gi as p,gt as m,ii as h,li as g,ln as _,mn as v,ot as y,ra as b,ti as x,tt as S,yt as C}from"./vendor-Di1mdAi5.js";import"./i18n-DaR2GB_4.js";import{t as w}from"./useWebSocket-CRYUFxmO.js";import{t as T}from"./utils-C4qVQ63O.js";import{p as E,t as D}from"./stores-JSLvWOQY.js";import{s as O}from"./view-navigation-BbHlzAQz.js";import{t as k}from"./button-99L74zdE.js";import{i as A}from"./ConfirmModal-Bm9f2Pg9.js";import{n as ee,r as j,t as M}from"./index-Du90vd1u.js";var N=e(s(),1),P=S(),F={pending:{icon:(0,P.jsx)(l,{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)(v,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,P.jsx)(g,{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)(p,{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:c}=d(),l=F[e.status],[u,f]=(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`,s),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?c(`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":c(`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:c(`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:c(`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`}),` `,c(`activity:task.retry`)]}),a&&i&&i.length>0&&(u?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{a(e.id,t.target.value),f(!1)},onBlur:()=>f(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:c(`activity:task.unassigned`)}),i.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:c(`activity:task.assignTitle`),children:[(0,P.jsx)(m,{className:`w-3 h-3`}),` `,c(`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}=d(),n=E(e=>e.phases),[r,i]=(0,N.useState)(`phase`),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),f=(0,N.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),p=(0,N.useMemo)(()=>[...new Set(f.map(e=>e.assignee).filter(e=>!!e))],[f]),m=(0,N.useCallback)(t=>e?.send?.(t),[e]),h=(0,N.useCallback)((e,t)=>m({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[m]),g=(0,N.useCallback)(e=>m({type:`goal.retryTask`,payload:{taskId:e}}),[m]),_=(0,N.useCallback)((e,t)=>m({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[m]),v=(0,N.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&m({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[m]),y=(0,N.useCallback)(e=>{o&&m({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),l(null)},[o,m]),b=(0,N.useCallback)(e=>{o&&m({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),l(null)},[o,m]),S={onStatusChange:h,onRetry:g,agents:p,onAssign:_};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: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:()=>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)(x,{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=f.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=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,()=>b(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}=d(),s=E(e=>e.phases),l=E(e=>e.overallPercent),p=E(e=>e.autonomous),m=E(e=>e.title),h=E(e=>e.goal),g=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:b.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?.(g===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,g]),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=g===`running`||g===`paused`,ie=g===`stopped`||g===`completed`||g===`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:l})})]}),G&&(0,P.jsx)(`span`,{className:T(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,g===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:g===`paused`||g===`stopped`?`border-warning/40 bg-warning/10 text-warning`:g===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:x??void 0,children:g})]}),(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`,p?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5`}),` `,a(p?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),re&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:X,title:a(g===`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:[g===`paused`?(0,P.jsx)(_,{className:`h-3.5 w-3.5`}):(0,P.jsx)(v,{className:`h-3.5 w-3.5`}),a(g===`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&&h&&(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)(f,{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:h})]}),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)(f,{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)(f,{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)(_,{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-BEcTB7SD.js";import{$n as n,$t as r,Mt as i,Vn as a,Xt as o,aa as s,at as c,bi as l,ca as u,ci as d,cn as f,en as p,fi as m,gt as h,ii as g,ln as _,mn as v,ot as y,pi as b,tt as x,ua as S,yt as C}from"./vendor-BmsAdDhb.js";import"./i18n-c37VNlP9.js";import{t as w}from"./useWebSocket-kb2VPjLc.js";import{t as T}from"./utils-DvgvNCoT.js";import{p as E,t as D}from"./stores-DVhvmaer.js";import{s as O}from"./view-navigation-D8lN47bJ.js";import{t as k}from"./button-GVbauxIJ.js";import{i as A}from"./ConfirmModal-C7H16wDN.js";import{n as ee,r as j,t as M}from"./index-196U0qsu.js";var N=e(S(),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)(d,{className:`w-4 h-4 animate-spin`}),color:`text-primary`,label:`In Progress`},blocked:{icon:(0,P.jsx)(v,{className:`w-4 h-4`}),color:`text-warning`,label:`Blocked`},failed:{icon:(0,P.jsx)(b,{className:`w-4 h-4`}),color:`text-destructive`,label:`Failed`},review:{icon:(0,P.jsx)(r,{className:`w-4 h-4`}),color:`text-info`,label:`Review`},completed:{icon:(0,P.jsx)(l,{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:i,onAssign:a,compact:o,className:c}){let{t:l}=s(),u=F[e.status],[f,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`,c),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)(d,{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`)}),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)(r,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),a&&i&&i.length>0&&(f?(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)(h,{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}=s(),n=E(e=>e.phases),[r,i]=(0,N.useState)(`phase`),[a,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),d=(0,N.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),p=(0,N.useMemo)(()=>[...new Set(d.map(e=>e.assignee).filter(e=>!!e))],[d]),m=(0,N.useCallback)(t=>e?.send?.(t),[e]),h=(0,N.useCallback)((e,t)=>m({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[m]),_=(0,N.useCallback)(e=>m({type:`goal.retryTask`,payload:{taskId:e}}),[m]),v=(0,N.useCallback)((e,t)=>m({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[m]),y=(0,N.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&m({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[m]),b=(0,N.useCallback)(e=>{a&&m({type:`goal.moveTask`,payload:{taskId:a,toPhaseId:e}}),c(null),u(null)},[a,m]),x=(0,N.useCallback)(e=>{a&&m({type:`goal.taskStatus`,payload:{taskId:a,status:e}}),c(null),u(null)},[a,m]),S={onStatusChange:h,onRetry:_,agents:p,onAssign:v};function C(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),u(null)}}}function D(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&u(e)},onDragLeave:()=>u(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===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)(g,{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)(o,{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}`,()=>b(e.id)),className:T(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,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)(f,{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(a===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`,l===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(a===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:r}=w(),{t:o}=s(),l=E(e=>e.phases),d=E(e=>e.overallPercent),m=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)(()=>{r?.send?.({type:`goal.list`}),r?.send?.({type:`goal.state`})},[r]);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=l.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 n=t.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:u.t(`activity:goalRun.planningAck`)}),z(e),L(``),r?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:U}}),O(`chat`)},[I,R,r,U]),J=(0,N.useCallback)(()=>{r?.send?.({type:`goal.stop`,payload:{}}),z(null)},[r]),Y=(0,N.useCallback)(()=>{r?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[r]),X=(0,N.useCallback)(()=>{r?.send?.(b===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[r,b]),Z=(0,N.useCallback)(()=>{r?.send?.({type:`goal.stop`,payload:{}})},[r]),Q=(0,N.useCallback)(()=>{r?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),z(null),L(``)},[r]),[te,$]=(0,N.useState)(!1),ne=(0,N.useCallback)(()=>{r?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[r]),re=b===`running`||b===`paused`,ie=b===`stopped`||b===`completed`||b===`failed`,ae=(0,N.useCallback)(e=>{e&&r?.send?.({type:`goal.load`,payload:{graphId:e}})},[r]);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)(n,{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:o(`activity:goalRun.summary`,{count:l.length,pct:d})})]}),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:o(`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:o(`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:o(`activity:goalRun.toggleAutonomousTitle`),className:T(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,m?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5`}),` `,o(m?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),re&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:X,title:o(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)(_,{className:`h-3.5 w-3.5`}):(0,P.jsx)(v,{className:`h-3.5 w-3.5`}),o(b===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:Z,title:o(`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`}),` `,o(`activity:goalRun.stop`)]})]}),G&&ie&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:Q,title:o(`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)(f,{className:`h-3.5 w-3.5`}),` `,o(`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:o(`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:o(`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:o(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:o(`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`}),` `,o(`activity:goalRun.revert`)]})]}),(0,P.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(y,{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)(p,{className:`h-3 w-3`}),` `,o(`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:o(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`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)(p,{className:`h-3 w-3`}),` `,o(`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`}),` `,o(`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)(p,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:o(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:o(`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`}),o(`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)(_,{className:`h-4 w-4`}),o(`activity:goalRun.startButton`)]})}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[o(`activity:goalRun.ctrlHint`),` ·`,` `,o(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:o(`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:o(`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{$t as t,Ar as n,Br as r,Bt as i,Ct as a,Di as o,Ft as s,Hn as c,Kt as l,Li as u,Mt as d,Oi as f,Pi as p,Pn as m,Qr as h,Ti as g,Vt as _,Xr as v,Yi as y,Yt as b,Zt as x,bi as S,bt as C,cn as ee,cr as w,en as T,hr as te,ht as ne,ii as re,kn as ie,li as E,ln as ae,mi as D,mn as oe,na as se,ni as ce,ot as le,pi as ue,qt as de,rn as fe,tt as pe,ua as me,wn as he,wt as ge,xi as _e}from"./vendor-BmsAdDhb.js";import{t as ve}from"./ws-client-BydCS6yi.js";import{t as O}from"./utils-DvgvNCoT.js";import{t as ye}from"./session-store-K_ozfq0o.js";import{b as k,j as be,u as xe}from"./stores-DVhvmaer.js";import{n as Se,t as Ce}from"./ModelPicker-fGNsJUXK.js";import{d as A,f as j,y as M}from"./index-196U0qsu.js";var N=e(me(),1);function we(e){let t=be(e=>e.wsUrl),n=be(e=>e.provider),r=be(e=>e.model),[i,a]=(0,N.useState)([]),[o,s]=(0,N.useState)([]),[c,l]=(0,N.useState)({}),[u,d]=(0,N.useState)(``),[f,p]=(0,N.useState)(``);return(0,N.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,N.useEffect)(()=>{e&&ve(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}function Te(e,t=!0){(0,N.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 Ee=4320*60*1e3,De=new Set([`completed`,`archived`]);function Oe(e,t){let n=Re(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Fe(t.liveAgentIdentities),i=F(e,t.defaultReviewStaleAfterMs??Ee),a=Me(e),o=[];for(let s of e.tasks)De.has(s.status)||(P(o,s,t.requireDueDate===!0),ke(o,s,n,r),Ae(o,s,n,i),a.length>1&&je(o,s,a));return o.sort(ze),{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 P(e,t,n){z(t.description)||V(e,t,`missing-description`,`warning`,`Add a description`),I(t).length===0&&V(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&&!z(t.dueDate)&&V(e,t,`missing-due-date`,`warning`,`Set a due date`),!B(t.labels)&&!B(t.tags)&&V(e,t,`missing-labels`,`warning`,`Add labels or tags`),!B(t.childTaskIds)&&!B(t.subtasks)&&V(e,t,`missing-subtasks`,`warning`,`Define subtasks`),B(t.successCriteria)||V(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function ke(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=I(t);if(!i||a.length===0||!z(i.leaseId)||!z(i.leaseExpiresAt)){V(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=Re(i.leaseExpiresAt);if(o===null||o<=n){V(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}a.some(e=>r.has(R(e)))||V(e,t,`abandoned-running-task`,`error`,`Assigned agent is not live`)}function Ae(e,t,n,r){if(t.status!==`review`)return;let i=Pe(t,`review`)??Re(t.updatedAt);i===null||n-i<=r||V(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/(3600*1e3)))}h`)}function je(e,t,n){let r=Ne(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[R(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(R(a.state)),c=i.get(R(o.state));if(!(s===void 0||c===void 0||Math.abs(c-s)<=1)){V(e,t,`skipped-lifecycle-state`,`error`,`Lifecycle skipped ${a.state} → ${o.state}`);return}}}function Me(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=L(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=>z(e));if(e.length===5)return e}for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=L(e);if(t.length>1)return t}}return[]}function F(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(Le(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(Le(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(Le(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function Ne(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`&&z(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=Ie(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:Re(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Pe(e,t){let n=null;for(let r of Ne(e))R(r.state)!==R(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function I(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(z)}function L(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(z(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=Ie(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function Fe(e){let t=new Set;if(!e)return t;for(let n of e)z(n)&&t.add(R(n));return t}function R(e){return e.trim().toLocaleLowerCase()}function Ie(...e){for(let t of e)if(z(t))return t.trim();return null}function z(e){return typeof e==`string`&&e.trim().length>0}function B(e){return Array.isArray(e)&&e.length>0}function Le(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Re(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 V(e,t,n,r,i){e.push({id:`${t.id}:${n}`,taskId:t.id,taskTitle:t.title,code:n,severity:r,message:i})}function ze(e,t){let n=Be(e.severity)-Be(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function Be(e){return e===`error`?0:1}var Ve=[`id`,`name`,`type`];function H(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 Ve){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}var U=pe();function He({options:e,selected:t,onChange:n,placeholder:r,emptyLabel:i}){let[a,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(``),u=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(!a)return;let e=e=>{u.current&&!u.current.contains(e.target)&&s(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]);let d=(0,N.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),p=(0,N.useMemo)(()=>{let t=c.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,c]),m=e=>{n(t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,U.jsxs)(`div`,{ref:u,className:`relative`,children:[t.length>0&&(0,U.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:t.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:`max-w-[150px] truncate`,children:d(e)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${d(e)}`,children:(0,U.jsx)(le,{size:11})})]},e))}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1.5 text-left text-xs transition-colors hover:border-primary/45 hover:bg-muted/80`,children:[(0,U.jsx)(ee,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:r??`Add…`}),(0,U.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),a&&(0,U.jsxs)(`div`,{className:`absolute z-50 mt-1 max-h-72 w-full min-w-[240px] overflow-hidden rounded-md border border-border/80 bg-popover shadow-xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,U.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:`Filter…`,className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),c&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>l(``),className:`text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(le,{className:`h-3 w-3`})})]}),(0,U.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[p.map(e=>{let n=t.includes(e.value);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(e.value),className:O(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,n?`bg-primary/8 text-primary`:`text-foreground`),children:[n?(0,U.jsx)(f,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,U.jsx)(`span`,{className:`w-3 shrink-0`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),p.length===0&&(0,U.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?i??`Nothing available`:`No match`})]})]})]})}function Ue({audit:e,onSelectTask:t}){let[n,r]=(0,N.useState)(!0),i=(0,N.useId)();if((0,N.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let a=We(e.issues);return(0,U.jsxs)(`section`,{"aria-labelledby":`${i}-title`,className:`shrink-0 border-b border-warning/25 bg-card/95 shadow-[inset_0_1px_0_hsl(var(--warning)/0.08)]`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-warning/25 bg-warning/10 text-warning`,children:(0,U.jsx)(s,{size:14,"aria-hidden":`true`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`h2`,{id:`${i}-title`,className:`text-xs font-semibold text-foreground`,children:[`Kanban Cleaner found `,e.issues.length,` `,e.issues.length===1?`issue`:`issues`]}),(0,U.jsxs)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.affectedTaskCount,` `,e.affectedTaskCount===1?`card needs`:`cards need`,` attention`]})]})]}),e.counts.error>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-destructive/25 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive`,children:[(0,U.jsx)(_e,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning`,children:[(0,U.jsx)(C,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,U.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,"aria-label":n?`Collapse Kanban Cleaner issues`:`Expand Kanban Cleaner issues`,onClick:()=>r(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:(0,U.jsx)(o,{size:14,"aria-hidden":`true`,className:O(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,U.jsx)(`ul`,{id:i,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:a.map(({taskId:e,taskTitle:n,issues:r})=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Open ${n}: ${r.map(e=>e.message).join(`, `)}`,className:`group flex w-full items-start gap-2 rounded-md border border-border/70 bg-background/70 px-2.5 py-2 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,U.jsx)(`span`,{className:O(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,r.some(e=>e.severity===`error`)?`bg-destructive shadow-[0_0_8px_hsl(var(--destructive)/0.55)]`:`bg-warning shadow-[0_0_8px_hsl(var(--warning)/0.45)]`),"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,U.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-[10px] leading-4 text-muted-foreground`,children:r.map(e=>e.message).join(` · `)})]})]})},e))})]})}function We(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 Ge={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function Ke({title:e,value:t,inherited:n,onSave:r}){let[a,o]=(0,N.useState)(t??Ge),[s,c]=(0,N.useState)(Je(t?.allow??[])),[l,u]=(0,N.useState)(Je(t?.deny??[])),[d,f]=(0,N.useState)(null);return(0,N.useEffect)(()=>{o(t??Ge),c(Je(t?.allow??[])),u(Je(t?.deny??[])),f(null)},[t]),(0,U.jsxs)(`details`,{className:`rounded-md border border-primary/25 bg-primary/5`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-xs font-semibold`,children:[(0,U.jsx)(i,{size:14,className:`text-primary`}),(0,U.jsx)(`span`,{children:e}),(0,U.jsx)(`span`,{className:`ml-auto font-normal text-muted-foreground`,children:t?.enabled?`${t.enforcement} · ${t.allow.length} allow · shell ${t.shellAccess}`:n?.enabled?`inherits board boundary`:`unrestricted`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[n?.enabled&&(0,U.jsx)(`div`,{className:`rounded border border-warning/25 bg-warning/10 px-2 py-1.5 text-muted-foreground`,children:`Board policy remains authoritative. This task policy can only narrow that scope.`}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),`Enable this boundary layer`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Outside scope`}),(0,U.jsxs)(`select`,{value:a.enforcement,onChange:e=>o({...a,enforcement:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,U.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,U.jsx)(`option`,{value:`block`,children:`Always block`})]})]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:`Shell / opaque tools`}),(0,U.jsxs)(`select`,{value:a.shellAccess,onChange:e=>o({...a,shellAccess:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,U.jsx)(`option`,{value:`confirm`,children:`Ask permission`}),(0,U.jsx)(`option`,{value:`block`,children:`Always block`}),(0,U.jsx)(`option`,{value:`allow`,children:`Allow`})]})]})]}),(0,U.jsx)(qe,{label:`Allow selectors`,value:s,onChange:c}),(0,U.jsx)(qe,{label:`Deny selectors`,value:l,onChange:u}),(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`One per line: kind:access:path — for example directory:read_write:packages/webui or file:read:README.md. Kinds: file, directory, package, glob. If an access type has no allow selector, it remains unrestricted except for deny rules. Shell “Allow” is opaque and can cross path selectors.`}),d&&(0,U.jsx)(`div`,{className:`text-destructive`,children:d}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=Ye(s),t=Ye(l);r({...a,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,U.jsx)(b,{size:13}),` Save boundary`]}),t&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:`Remove layer`})]})]})]})}function qe({label:e,value:t,onChange:n}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,U.jsx)(`textarea`,{rows:3,value:t,onChange:e=>n(e.target.value),className:`w-full resize-y rounded border bg-background px-2 py-1.5 font-mono text-[11px] outline-none focus:border-primary`})]})}function Je(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
+
`)}function Ye(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 Xe(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function W(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function G(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function K(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?G(W(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 Ze(e){let t=W(e.before),n=W(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 Qe(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 $e(e){let t=W(e.before),n=W(e.after);if(e.type.startsWith(`task.file.`)){let e=G(n.filePath),t=G(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[G(n.outcome),G(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=G(t.columnId),r=G(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=Ze(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=G(t.stage),r=G(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=G(n.name)??G(n.agentId)??G(n.role),t=G(n.provider),r=G(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[G(n.description),G(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[G(n.name),G(n.status)].filter(Boolean).join(` · `)||void 0}function et(e){let t=e.type;return G(W(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 tt(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 nt(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 rt(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 it({event:e}){let t=W(e.after),n=G(t.provider),r=G(t.model),i=G(t.modelRouting),a=G(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=G(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`fallback-`,t+1,`:`,e]},`${e}:${t}`)),s!==void 0&&(0,U.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function at({task:e,events:t,sessionId:n,loading:r=!1,error:i,onRefresh:a}){let[o,s]=(0,N.useState)(`all`),[c,l]=(0,N.useState)(``),[u,d]=(0,N.useState)(!1),p=(0,N.useMemo)(()=>rt(e,t,n),[e,t,n]),m=(0,N.useMemo)(()=>({all:p.length,execution:p.filter(e=>K(e)===`execution`).length,changes:p.filter(e=>K(e)===`changes`).length,notes:p.filter(e=>K(e)===`notes`).length,failures:p.filter(e=>K(e)===`failures`).length}),[p]),h=(0,N.useMemo)(()=>{let e=c.trim().toLowerCase();return p.filter(t=>o!==`all`&&K(t)!==o?!1:!e||[Qe(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))},[p,o,c]),g=j(h,50,`${o}:${c}`),_=g.pageItems,y=[...new Set(p.map(e=>e.actor).filter(Boolean))].length,b=[...new Set(p.map(e=>e.sessionId??n).filter(Boolean))].length;return(0,U.jsxs)(`section`,{"aria-label":`Task activity`,className:`mt-5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,U.jsx)(se,{className:`size-3.5 text-primary`}),(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Activity ledger`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground`,children:[h.length,`/`,p.length]}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(Xe(e,h,`filtered`),null,2)),d(!0)}catch{d(!1)}},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Copy visible task activity JSON`,title:`Copy filtered activity JSON`,children:u?(0,U.jsx)(f,{className:`size-3 text-success`}):(0,U.jsx)(ce,{className:`size-3`})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Xe(e,p,`full`),null,2),n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${e.title.replace(/[^a-z0-9]+/gi,`-`).replace(/^-|-$/g,``).toLowerCase()||e.id}-activity.json`,r.click(),URL.revokeObjectURL(n)},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Download full task activity JSON`,title:`Download full activity JSON`,children:(0,U.jsx)(v,{className:`size-3`})}),a&&(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`Refresh task activity`,children:(0,U.jsx)(fe,{className:O(`size-3`,r&&`animate-spin`)})})]})]}),(0,U.jsx)(`div`,{className:`mb-2 grid grid-cols-4 gap-px overflow-hidden rounded-md border border-border/60 bg-border/60 text-center`,children:[[`Events`,p.length],[`Actors`,y],[`Sessions`,b],[`Failures`,m.failures]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,U.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,U.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(e),className:O(`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,` `,m[e]]},e))}),(0,U.jsxs)(`div`,{className:`relative mb-3`,children:[(0,U.jsx)(de,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,U.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),"aria-label":`Search task activity`,placeholder:`Search agent, session, model, result, field…`,className:`h-8 w-full rounded-md border bg-background pl-7 pr-7 text-[11px] outline-none focus:border-primary`}),c&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>l(``),"aria-label":`Clear task activity search`,className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(le,{className:`size-3`})})]}),i&&(0,U.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] text-destructive`,children:i}),h.length===0?(0,U.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-6 text-center text-[11px] text-muted-foreground`,children:`No activity matches this filter.`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:_.map(e=>{let t=$e(e),r=e.sessionId??n,i=Ze(e),a=K(e)===`failures`,o=e.type.includes(`completed`)||G(W(e.after).outcome)===`succeeded`;return(0,U.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,U.jsx)(`span`,{className:O(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,et(e))}),(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:Qe(e)}),(0,U.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,U.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:tt(e.ts)})]}),t&&(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,U.jsxs)(`div`,{className:O(`mt-1.5 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border px-2 py-1.5 text-[10px] leading-4`,a?`border-destructive/30 bg-destructive/5 text-destructive`:o?`border-success/30 bg-success/5 text-success`:`border-border/70 bg-muted/35 text-foreground`),children:[(0,U.jsxs)(`strong`,{children:[a?`Error`:o?`Result`:`Reason / result`,`:`]}),` `,e.note]}),i.length>0&&e.type!==`task.assigned`&&e.type!==`task.assignment.snapshot`&&!e.type.startsWith(`task.file.`)&&(0,U.jsx)(`div`,{className:`mt-1.5 space-y-1 rounded border border-border/60 bg-background/50 p-1.5`,children:i.map(e=>(0,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,U.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,U.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`line-through opacity-70`,children:nt(e.before)}),` `,(0,U.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,U.jsx)(`span`,{className:`text-foreground`,children:nt(e.after)})]})]},e.field))}),(0,U.jsx)(it,{event:e}),(e.actor||r||e.subagentId||e.runTaskId||e.correlationId)&&(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),r&&(0,U.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:r,children:[`session:`,r]}),e.subagentId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,U.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:`Full event payload`}),(0,U.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded border bg-muted/30 p-2 text-[9px] leading-4 text-foreground`,children:JSON.stringify(e,null,2)})]})]},e.id)})}),(0,U.jsx)(A,{page:g.page,pageSize:g.pageSize,totalItems:g.totalItems,onPageChange:g.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function ot(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function q(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function st(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 ct(e,t){return q(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 lt(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function ut(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 dt(e,t,n){let r=rt(e,t,n).filter(st).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=ot(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=ct(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=q(t.name)??q(t.agentId)??q(t.role)??e.actor??u.owner,u.provider=q(t.provider)??u.provider,u.model=q(t.model)??u.model,u.routingMode=q(t.modelRouting)??u.routingMode,u.fallbackProfile=q(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??q(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??q(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=q(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=q(t.error)??e.note??u.error),lt(l)&&(u.endedAt=e.ts),i.set(a,u),s=lt(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:ut(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function ft(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 mt({task:e,events:t,sessionId:n}){let r=dt(e,t,n),i=j(r,8,e.id);return r.length?(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(w,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Execution attempts`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[r.length,` total`]}),(0,U.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${pt(r[0].status)}`,children:[`latest:`,r[0].status]}),(0,U.jsx)(o,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[i.pageItems.map(e=>(0,U.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,U.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,U.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${pt(e.status)}`,children:e.status}),(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,U.jsx)(ge,{className:`size-3`}),` `,ft(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,U.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(u,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,U.jsx)(x,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,U.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,U.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,U.jsxs)(`p`,{className:`mt-1.5 break-all font-mono text-[9px] text-muted-foreground`,children:[`fallback:`,[e.fallbackProfile?`profile:${e.fallbackProfile}`:``,...e.fallbackModels].filter(Boolean).join(` → `)]}),e.error&&(0,U.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[10px] text-destructive`,children:[(0,U.jsx)(`strong`,{children:`Error:`}),` `,e.error]}),e.result&&(0,U.jsxs)(`p`,{className:`mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border border-success/30 bg-success/5 px-2 py-1.5 text-[10px] text-success`,children:[(0,U.jsx)(`strong`,{children:`Result:`}),` `,e.result]})]},e.attempt)),(0,U.jsx)(A,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function ht(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function J(e){return H(e)}function gt(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 _t(e,t,n,r,i,a,o){let s=rt(t,n,r),c=gt(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=ht(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=J(u?.modelRouting)??J(f.modelRouting)??`session`,m=J(u?.provider)??J(f.provider)??(p===`session`?J(i):void 0),h=J(u?.model)??J(f.model)??(p===`session`?J(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(J).filter(e=>e!==void 0),_=J(u?.fallbackProfile)??J(f.fallbackProfile),v=J(u?.name)??J(u?.agentId)??J(u?.role)??J(t.assignee)??J(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(ht(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,ee=s.find(e=>K(e)===`failures`),w=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${Y(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??ee?.note,lastResult:u?.lastResult??w?.note,eventCount:s.length,lastActivity:s[0]}}function Y(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function vt(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 X({label:e,value:t,mono:n=!1}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function Z({icon:e,title:t,children:n}){return(0,U.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,U.jsxs)(`h4`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[e,t]}),(0,U.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function yt({items:e}){return e.length?(0,U.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,U.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`None`})}function bt({board:e,task:t,events:n,presence:r,sessionId:a,sessionProvider:s,sessionModel:c}){let l=_t(e,t,n,a,s,c,r),d=t.assignment,f=t.successCriteria?.length??0,m=t.successCriteria?.filter(e=>e.status===`passed`).length??0,h=[t.parentTaskId,...t.childTaskIds??[],t.chain?.previousTaskId,t.chain?.nextTaskId,t.mergedIntoTaskId,...t.mergedFromTaskIds??[]].filter(e=>!!e),g=gt(e,[...new Set(h)]);return(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(p,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Task intelligence`}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:t.status}),(0,U.jsxs)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:[l.eventCount,` events`]}),(0,U.jsx)(o,{className:`size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,U.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,U.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:l.column}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`stage:`,t.lifecycle?.currentStage??`legacy`]}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`priority:`,t.priority]}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`type:`,t.type??`inferred`]})]}),(0,U.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,U.jsx)(`strong`,{children:`Why here:`}),` `,l.reason]}),l.blockers.length>0&&(0,U.jsxs)(`p`,{className:`mt-1 text-[10px] text-warning`,children:[l.blockers.length,` unresolved blocker`,l.blockers.length===1?``:`s`]})]}),(0,U.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,U.jsxs)(Z,{icon:(0,U.jsx)(u,{className:`size-3`}),title:`Ownership & runtime`,children:[(0,U.jsx)(X,{label:`Owner`,value:l.owner}),(0,U.jsx)(X,{label:`Assignee`,value:J(t.assignee)??J(t.assignedAgent)??`—`}),(0,U.jsx)(X,{label:`Agent ID`,value:J(d?.agentId)??`—`,mono:!0}),(0,U.jsx)(X,{label:`Agent name / role`,value:[J(d?.name),J(d?.role)].filter(Boolean).join(` · `)||`—`}),(0,U.jsx)(X,{label:`Run status`,value:J(d?.status)??`unassigned`}),(0,U.jsx)(X,{label:`Subagent`,value:J(d?.subagentId)??`—`,mono:!0}),(0,U.jsx)(X,{label:`Run task`,value:J(d?.runTaskId)??`—`,mono:!0}),(0,U.jsx)(X,{label:`Session(s)`,value:l.sessions.join(`, `)||`Unknown`,mono:!0}),(0,U.jsx)(X,{label:`Users / presence`,value:l.presence.length?l.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,U.jsxs)(Z,{icon:(0,U.jsx)(x,{className:`size-3`}),title:`Model route & fallback`,children:[(0,U.jsx)(X,{label:`Routing mode`,value:l.routingMode}),(0,U.jsx)(X,{label:`Primary`,value:l.primaryModel,mono:!0}),(0,U.jsx)(X,{label:`Provider`,value:l.provider??`—`,mono:!0}),(0,U.jsx)(X,{label:`Model`,value:l.model??`—`,mono:!0}),(0,U.jsx)(X,{label:`Fallback route`,value:l.fallbackRoute,mono:!0}),(0,U.jsx)(X,{label:`Skills`,value:d?.skills?.map(J).filter(Boolean).join(`, `)||`Default`}),(0,U.jsx)(X,{label:`Tools`,value:d?.tools?.map(J).filter(Boolean).join(`, `)||`Default toolset`}),(0,U.jsx)(X,{label:`Capabilities`,value:d?.allowedCapabilities?.map(J).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,U.jsxs)(Z,{icon:(0,U.jsx)(i,{className:`size-3`}),title:`Execution policy & outcome`,children:[(0,U.jsx)(X,{label:`Attempts`,value:`${l.attempts}${d?.maxAttempts?` / ${d.maxAttempts}`:``}`}),(0,U.jsx)(X,{label:`Retry policy`,value:d?.retryPolicy??t.retryPolicy??`off`}),(0,U.jsx)(X,{label:`Cost ceiling`,value:(d?.costCeilingUsd??t.costCeilingUsd)==null?`Unbounded`:`$${(d?.costCeilingUsd??t.costCeilingUsd).toFixed(2)}`}),(0,U.jsx)(X,{label:`Failures / done`,value:`${l.failures} / ${l.completions}`}),(0,U.jsx)(X,{label:`Checks`,value:`${m} / ${f} passed`}),(0,U.jsx)(X,{label:`Last failure`,value:l.lastFailure??`—`}),(0,U.jsx)(X,{label:`Result`,value:l.lastResult??`No result recorded`})]}),(0,U.jsxs)(Z,{icon:(0,U.jsx)(se,{className:`size-3`}),title:`Timing & audit coverage`,children:[(0,U.jsx)(X,{label:`Created`,value:Y(t.createdAt)}),(0,U.jsx)(X,{label:`Updated`,value:Y(t.updatedAt)}),(0,U.jsx)(X,{label:`Due`,value:Y(t.dueDate)}),(0,U.jsx)(X,{label:`Dispatched`,value:Y(d?.dispatchedAt??d?.claimedAt)}),(0,U.jsx)(X,{label:`Completed`,value:Y(d?.completedAt??t.completedAt)}),(0,U.jsx)(X,{label:`Duration`,value:vt(d?.dispatchedAt??d?.claimedAt,d?.completedAt)}),(0,U.jsx)(X,{label:`Heartbeat`,value:Y(d?.heartbeatAt)}),(0,U.jsx)(X,{label:`Lease expires`,value:Y(d?.leaseExpiresAt)}),(0,U.jsx)(X,{label:`Actors`,value:l.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,U.jsxs)(Z,{icon:(0,U.jsx)(te,{className:`size-3`}),title:`Dependencies, chain & provenance`,children:[(0,U.jsx)(X,{label:`Dependencies`,value:(0,U.jsx)(yt,{items:l.dependencies})}),(0,U.jsx)(X,{label:`Other relations`,value:(0,U.jsx)(yt,{items:g})}),(0,U.jsx)(X,{label:`Chain`,value:t.chain?`${t.chain.chainId} · position ${t.chain.order}`:`None`,mono:!0}),(0,U.jsx)(X,{label:`Origin system`,value:t.origin?.system??`manual`}),(0,U.jsx)(X,{label:`Origin IDs`,value:t.origin&&[t.origin.graphId,t.origin.phaseId,t.origin.taskId,t.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,U.jsx)(X,{label:`Task ID`,value:t.id,mono:!0}),(0,U.jsx)(X,{label:`Board ID`,value:e.id,mono:!0})]})]})]})}var xt={passed:{icon:S,label:`Passed`,className:`text-success`},failed:{icon:ue,label:`Failed`,className:`text-destructive`},needs_human:{icon:C,label:`Needs Review`,className:`text-warning`},incomplete:{icon:_,label:`Incomplete`,className:`text-muted-foreground`}},St={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 Ct(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 wt({verdict:e}){let t=xt[e],n=t.icon;return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-semibold ${t.className}`,children:[(0,U.jsx)(n,{size:13}),t.label]})}function Tt({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,N.useState)(n);return(0,U.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-2 px-3 py-2 text-xs font-semibold uppercase text-muted-foreground hover:bg-muted/50`,children:[i?(0,U.jsx)(o,{size:13}):(0,U.jsx)(g,{size:13}),(0,U.jsx)(t,{size:13}),e]}),i&&(0,U.jsx)(`div`,{className:`border-t px-3 py-2 space-y-2`,children:r})]})}function Et({check:e}){let t=St[e.status],[n,i]=(0,N.useState)(!1),a=e.error||e.backingRefs?.length;return(0,U.jsxs)(`div`,{className:`rounded border bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`font-medium ${t.className}`,children:t.label}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:e.type})]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:e.description})]}),a&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(!n),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:n?(0,U.jsx)(o,{size:13}):(0,U.jsx)(g,{size:13})})]}),n&&(0,U.jsxs)(`div`,{className:`mt-2 space-y-1.5 border-t pt-2`,children:[e.error&&(0,U.jsx)(`div`,{className:`rounded bg-destructive/10 px-2 py-1 text-destructive`,children:e.error}),e.backingRefs?.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,U.jsx)(r,{size:11}),(0,U.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-[10px]`,children:[`(`,e.kind,`)`]}),e.summary&&(0,U.jsxs)(`span`,{className:`truncate`,children:[`— `,e.summary]})]},t))]})]})}function Dt({fileScope:e}){return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Expected `,(0,U.jsx)(`strong`,{children:e.expectedChanges}),` changes`]}),(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Actual `,(0,U.jsx)(`strong`,{children:e.actualChanges}),` changes`]}),(0,U.jsx)(`span`,{className:e.scopeMatches?`text-success`:`text-destructive`,children:e.scopeMatches?`✅ Scope matches`:`❌ Scope mismatch`})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.files.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:e.operation===`create`?`text-success`:e.operation===`delete`?`text-destructive`:`text-muted-foreground`,children:e.operation===`create`?`+`:e.operation===`delete`?`−`:`∼`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,U.jsxs)(`span`,{className:`text-[10px]`,children:[e.linesChanged,` line`,e.linesChanged===1?``:`s`]}),!e.expected&&(0,U.jsx)(`span`,{className:`rounded bg-warning/10 px-1 text-[10px] text-warning`,children:`unexpected`})]},t))})]})}function Ot({subtasks:e}){return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{children:[`Total `,(0,U.jsx)(`strong`,{children:e.total})]}),(0,U.jsxs)(`span`,{className:`text-success`,children:[`Completed `,(0,U.jsx)(`strong`,{children:e.completed})]}),e.failed>0&&(0,U.jsxs)(`span`,{className:`text-destructive`,children:[`Failed `,(0,U.jsx)(`strong`,{children:e.failed})]})]}),(0,U.jsx)(`div`,{className:`space-y-1`,children:e.children.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.verdict===`passed`?(0,U.jsx)(`span`,{className:`text-success`,children:`✓`}):e.verdict===`failed`?(0,U.jsx)(`span`,{className:`text-destructive`,children:`✗`}):e.verdict===`needs_human`?(0,U.jsx)(`span`,{className:`text-warning`,children:`⚠`}):(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`○`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},t))})]})}function kt({attachments:e}){return(0,U.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded border bg-muted/30 px-2 py-1.5 text-xs`,children:[(0,U.jsx)(n,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,U.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.path?(0,U.jsxs)(`span`,{className:`truncate block`,children:[e.path,(0,U.jsx)(`span`,{className:`ml-1 rounded bg-muted px-1 text-[10px]`,children:e.kind})]}):(0,U.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px]`,children:e.kind})}),e.content&&(0,U.jsxs)(`pre`,{className:`mt-1 max-h-20 overflow-auto rounded bg-background p-1 text-[10px] text-muted-foreground`,children:[e.content.slice(0,500),e.content.length>500?`
|
|
3
|
+
…`:``]})]})]},t))})}function At({report:e}){return(0,U.jsxs)(`div`,{className:`mt-5 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:`Verification Report`}),(0,U.jsx)(wt,{verdict:e.verdict})]}),e.markdownSummary&&(0,U.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:Ct(e.startedAt,e.completedAt)})]}),e.markdownSummary&&(0,U.jsx)(`div`,{className:`rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground whitespace-pre-wrap`,children:e.markdownSummary}),e.checks.length>0&&(0,U.jsx)(Tt,{title:`Check Results`,icon:c,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,U.jsx)(Et,{check:e},e.checkId))}),e.fileScope&&(0,U.jsx)(Tt,{title:`File Scope`,icon:r,defaultOpen:!e.fileScope.scopeMatches,children:(0,U.jsx)(Dt,{fileScope:e.fileScope})}),e.subtasks&&(0,U.jsx)(Tt,{title:`Sub-Tasks`,icon:c,children:(0,U.jsx)(Ot,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,U.jsx)(Tt,{title:`Attachments (${e.attachments.length})`,icon:n,children:(0,U.jsx)(kt,{attachments:e.attachments})})]})}function jt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Mt(e){return e===`completed`||e===`failed`||e===`cancelled`}function Nt(e,t){return t?Math.round(e/t*100):0}function Pt(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 _=Nt(o.filter(e=>!!e.actor).length,o.length),v=Nt(o.filter(e=>!!e.sessionId).length,o.length),y=Nt(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={...jt([...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=>Mt(String(jt(e.after).status??``))&&!!e.note?.trim()));return Mt(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 Ft(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 It({board:e,task:t,events:n}){let r=Pt(e,t,n),i=j(r.findings,8,t.id);return(0,U.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(_,{className:`size-4 text-primary`}),(0,U.jsx)(`span`,{className:`text-xs font-semibold`,children:`Risk & audit quality`}),(0,U.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r.score>=90?`bg-success/10 text-success`:r.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:[`audit `,r.score,`/100`]}),r.critical>0&&(0,U.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:[r.critical,` critical`]}),(0,U.jsx)(o,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,U.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1 text-center sm:grid-cols-6`,children:[[`Events`,r.coverage.durableEvents],[`Actor`,`${r.coverage.actorPercent}%`],[`Session`,`${r.coverage.sessionPercent}%`],[`Reasons`,`${r.coverage.reasonPercent}%`],[`Route`,r.coverage.hasExecutionRoute?`yes`:`no`],[`Outcome`,r.coverage.hasTerminalEvidence?`yes`:`no`]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,U.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),r.findings.length===0?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-success/30 bg-success/5 px-2.5 py-2 text-[11px] text-success`,children:[(0,U.jsx)(S,{className:`size-4`}),` No deterministic task risks detected.`]}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[i.pageItems.map(e=>(0,U.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${Ft(e.severity)}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,U.jsx)(h,{className:`size-3.5`}):(0,U.jsx)(C,{className:`size-3.5`}),e.title,(0,U.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[e.category,` · `,e.severity]})]}),(0,U.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:e.detail}),(0,U.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,U.jsx)(`strong`,{children:`Next:`}),` `,e.remediation]})]},e.id)),(0,U.jsx)(A,{page:i.page,pageSize:i.pageSize,totalItems:i.totalItems,onPageChange:i.setPage,compact:!0,itemLabel:`risk findings`})]})]})]})}var Lt=5e3,Rt=12;function zt(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 Bt({presence:e=[]}){return e.length===0?null:(0,U.jsxs)(`section`,{"aria-label":`Board presence`,className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-card/50 px-4 py-2`,children:[(0,U.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Live board users`}),e.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 text-xs shadow-sm`,title:`Session ${e.sessionId} · last seen ${e.lastSeenAt}`,children:[(0,U.jsx)(`span`,{role:`img`,"aria-label":e.active?`active`:`inactive`,className:O(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,U.jsx)(D,{size:13,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,U.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,U.jsx)(E,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,U.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:zt(e.lastSeenAt)})]},e.id))]})}function Vt({board:e,snapshot:t,sendKanban:n}){let[r,a]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!0),[l,u]=(0,N.useState)(`deterministic`),[d,f]=(0,N.useState)(`session`),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(``),[y,x]=(0,N.useState)([]),[S,C]=(0,N.useState)([]),[ee,w]=(0,N.useState)(10),T=Se(r&&l===`agentic`),te=we(r&&l===`agentic`);(0,N.useEffect)(()=>{let t=e.supervisor;c(t?.enabled??!0),u(t?.mode??`deterministic`),f(t?.routing?.mode??`session`),m(t?.routing?.provider??``),g(t?.routing?.model??``),v(t?.routing?.fallbackProfile??``),x(t?.routing?.fallbackModels??[]),C(t?.skills??[]),w(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,e.supervisor]);let ne=()=>{let t={mode:d,...d===`fixed`&&p?{provider:p}:{},...d===`fixed`&&h?{model:h}:{},...d===`fallback_profile`&&_?{fallbackProfile:_}:{},...y.length?{fallbackModels:y}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:s,mode:l,intervalMs:Math.max(2,ee)*1e3,recoveryMode:`auto`,...l===`agentic`?{routing:t,skills:S}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},re=s?t?.status??`starting`:`disabled`;return(0,U.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-1.5 text-left text-[11px] hover:bg-muted/40`,children:[(0,U.jsx)(i,{size:13,className:re===`healthy`?`text-success`:`text-warning`}),(0,U.jsx)(`span`,{className:`font-semibold`,children:`Kanban Agent`}),(0,U.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[l,` · `,re]}),t?.summary&&(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,U.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?`checked ${en(t.lastAuditAt)} ago`:`not checked`}),(0,U.jsx)(o,{size:13,className:O(`transition-transform`,r&&`rotate-180`)})]}),r&&(0,U.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,U.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked)}),(0,U.jsx)(`span`,{children:`Watch this board`})]}),(0,U.jsx)($,{label:`Supervisor engine`,value:l,options:[`deterministic`,`agentic`],onChange:e=>u(e)}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Audit interval (seconds)`}),(0,U.jsx)(`input`,{type:`number`,min:2,value:ee,onChange:e=>w(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,U.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:ne,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,U.jsx)(b,{size:13}),` Save`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.supervisor.audit`,{boardId:e.id}),className:`inline-flex h-8 items-center gap-1 rounded-md border px-3 hover:bg-muted`,children:[(0,U.jsx)(se,{size:13}),` Audit now`]})]}),l===`deterministic`?(0,U.jsx)(`div`,{className:`lg:col-span-4 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-muted-foreground`,children:`Deterministic mode uses no provider, model, token, or billing. It repairs assignment/status/column drift and recovers expired leases.`}):(0,U.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,U.jsx)($,{label:`Kanban Agent model source`,value:d,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>f(e)}),d===`fixed`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,U.jsx)(Ce,{value:h||void 0,provider:p||void 0,candidates:T,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{g(e),m(t)}})]}),d===`fallback_profile`&&(0,U.jsx)($,{label:`Fallback profile (first model is primary)`,value:_,options:Object.keys(te.fallbackProfiles),placeholder:`Select configured profile…`,onChange:v}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Supervisor skills`}),(0,U.jsx)(He,{options:te.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,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Extra fallback models`}),(0,U.jsx)(He,{options:T.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:y,onChange:x,placeholder:`Optional ordered fallbacks…`})]})]})]})]})}function Ht(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 Ut({onClose:e}){let t=be(e=>e.wsUrl),n=ye(e=>e.session?.id??null),r=k(e=>e.agents),{boards:i,boardTotal:o,activeBoardTotal:s,orphanedBoardTotal:c,activeBoardId:l,activeBoard:u,loading:d,error:f,queueHealth:p,supervisorSnapshot:m,setLoading:h,setActiveBoardId:g}=xe(),[_,v]=(0,N.useState)(``),[b,x]=(0,N.useState)(1),[S,C]=(0,N.useState)([]),[w,T]=(0,N.useState)(``),te=(0,N.useRef)(null);Te(te);let[ne,ie]=(0,N.useState)(``),[E,ae]=(0,N.useState)(null),[D,oe]=(0,N.useState)([]),[se,ue]=(0,N.useState)(),[de,pe]=(0,N.useState)(!1),[me,he]=(0,N.useState)(null),[ge,_e]=(0,N.useState)(0),[Se,Ce]=(0,N.useState)(null),j=(0,N.useRef)(null),M=(0,N.useMemo)(()=>ve(t),[t]),we=u?.tasks.find(e=>e.id===E)??null,Ee=(0,N.useMemo)(()=>{let e=new Set;for(let t of r.values())t.status===`running`&&(e.add(t.id),e.add(t.name));return e},[r]),De=(0,N.useMemo)(()=>{let e=new Set;n&&e.add(n);for(let t of S)e.add(t);for(let t of r.values())t.status===`running`&&t.sessionId&&e.add(t.sessionId);return[...e]},[r,S,n]),P=e=>e.presence?.some(e=>e.active)===!0||e.tags?.some(e=>e.startsWith(`session:`)&&De.includes(e.slice(8)))===!0,ke=i.filter(P),Ae=i.filter(e=>!P(e)),je=(0,N.useMemo)(()=>u?Oe(u,{now:Date.now(),liveAgentIdentities:Ee,requireDueDate:u.lifecycle?.mode===`managed`}):null,[u,Ee]),Me=(0,N.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]),F=(e,t={})=>{h(!0),M.send({type:e,payload:t})},Ne=(e,t={})=>{M.send({type:e,payload:t})},Pe=(0,N.useMemo)(()=>Ht(u),[u]),I=(e=b)=>F(`kanban.list`,{page:e,pageSize:Rt,activeSessionIds:De}),L=(e=l)=>{e&&F(`kanban.get`,{boardId:e})};(0,N.useEffect)(()=>{I()},[]),(0,N.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();C(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,N.useEffect)(()=>{let e=n?i.find(e=>e.tags?.includes(`session:${n}`)):void 0,t=!!(n&&e)&&j.current!==n,r=t?e:l?void 0:i[0];r?.id&&(t&&(j.current=n),g(r.id),F(`kanban.get`,{boardId:r.id}))},[i,l,n,g]),(0,N.useEffect)(()=>{u&&E&&!u.tasks.some(e=>e.id===E)&&ae(null)},[u,E]),(0,N.useEffect)(()=>{l&&(F(`kanban.health`,{boardId:l}),F(`kanban.supervisor.status`,{boardId:l}))},[l]),(0,N.useEffect)(()=>{if(!l)return;let e=setInterval(()=>{M.send({type:`kanban.get`,payload:{boardId:l}}),M.send({type:`kanban.health`,payload:{boardId:l}})},5e3);return()=>clearInterval(e)},[l,M]),(0,N.useEffect)(()=>{let e=setInterval(()=>{M.send({type:`kanban.list`,payload:{page:b,pageSize:Rt,activeSessionIds:De}})},8e3);return()=>clearInterval(e)},[De,b,M]);let Fe=e=>{x(e),g(null),I(e)};(0,N.useEffect)(()=>{ue(void 0)},[l,E]),(0,N.useEffect)(()=>{if(!l||!E)return;let e=l,t=E;pe(!0),he(null);let n=M.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){he(r.error??`Task activity could not be loaded.`),pe(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(oe(r.data.events??[]),ue(r.data.presence??[]),pe(!1))});return M.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Lt}}),n},[l,E,we?.updatedAt,ge,M]),(0,N.useEffect)(()=>{if(!(!l||!E))return M.on.bind(M)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===l&&t.taskId===E&&_e(e=>e+1)})},[l,E,M]);let R=()=>{let e=_.trim();e&&(v(``),F(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Ie=()=>{if(!u)return;let e=w.trim();e&&(T(``),F(`kanban.task.add`,{boardId:u.id,title:e,columnId:u.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>L(u.id),150))},z=()=>{if(!u)return;let e=ne.trim();e&&(ie(``),F(`kanban.column.add`,{boardId:u.id,title:e}),window.setTimeout(()=>L(u.id),150))},B=()=>{u&&(F(`kanban.delete`,{boardId:u.id}),window.setTimeout(I,150))},Le=()=>{u&&(F(`kanban.duplicate`,{boardId:u.id,title:`${u.title} Copy`}),window.setTimeout(I,150))},Re=e=>{u&&(F(`kanban.task.remove`,{boardId:u.id,taskId:e.id}),window.setTimeout(()=>L(u.id),150))},V=(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;F(`kanban.task.move`,{boardId:u.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>L(u.id),150)};return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,U.jsxs)(`aside`,{className:`flex max-h-[45dvh] w-full shrink-0 flex-col border-b bg-card/40 md:max-h-none md:w-[280px] md:border-b-0 md:border-r`,children:[(0,U.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,U.jsx)(`button`,{type:`button`,title:`Back`,onClick:e,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(y,{size:16})}),(0,U.jsx)(re,{size:17,className:`text-primary`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Kanban`}),(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[o,` boards · `,s,` active · `,c,` orphaned`]})]}),(0,U.jsx)(`button`,{type:`button`,title:`Refresh`,onClick:()=>I(),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(fe,{size:15,className:d?`animate-spin`:void 0})})]}),(0,U.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,U.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&R()},placeholder:`New board`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,title:`Create board`,onClick:R,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,U.jsx)(ee,{size:16})})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[ke.length>0&&(0,U.jsxs)(`div`,{className:`mb-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-success`,children:[`Active session · `,s]}),ke.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),F(`kanban.get`,{boardId:e.id})},className:O(`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,U.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success`}),e.taskCount,` tasks`]}),(0,U.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id)),Ae.length>0&&(0,U.jsxs)(`div`,{className:`mb-1 mt-2 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`No active session · `,c]}),Ae.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),F(`kanban.get`,{boardId:e.id})},className:O(`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,U.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/45`}),e.taskCount,` tasks`]}),(0,U.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]},e.id))]}),(0,U.jsx)(A,{page:b,pageSize:Rt,totalItems:o,onPageChange:Fe,compact:!0,itemLabel:`boards`})]}),(0,U.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4`,children:[(0,U.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:u?.title??`No board selected`}),(0,U.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,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()},placeholder:`New task`,className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-56`}),(0,U.jsx)(`button`,{type:`button`,title:`Add task`,onClick:Ie,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,U.jsx)(ee,{size:16})}),(0,U.jsx)(`input`,{value:ne,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Enter`&&z()},placeholder:`New column`,className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-44`}),(0,U.jsx)(`button`,{type:`button`,title:`Add column`,onClick:z,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex`,children:(0,U.jsx)(re,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Duplicate board`,onClick:Le,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(ce,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Delete board`,onClick:B,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive sm:flex`,children:(0,U.jsx)(a,{size:16})})]})]}),u&&(0,U.jsx)(Bt,{presence:u.presence}),u&&(0,U.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,U.jsx)(Ke,{title:`Board boundary`,value:u.boundary,onSave:e=>{F(`kanban.update`,{boardId:u.id,boundary:e}),window.setTimeout(()=>L(u.id),150)}})}),u&&Pe&&(0,U.jsx)(Wt,{runLink:Pe,sendRaw:Ne}),u&&!Pe&&u.tasks.length>0&&(0,U.jsx)(Gt,{boardId:u.id,sendKanban:F}),u&&(0,U.jsx)(Vt,{board:u,snapshot:m,sendKanban:F}),je&&(0,U.jsx)(Ue,{audit:je,onSelectTask:ae}),f&&(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 text-sm text-destructive`,children:[(0,U.jsx)(le,{size:15}),(0,U.jsx)(`span`,{className:`truncate`,children:f})]}),(0,U.jsx)(`div`,{ref:te,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:u?(0,U.jsxs)(U.Fragment,{children:[p&&(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:`Queue health`}),p.counts.ready>0&&(0,U.jsxs)(`span`,{title:`Claimable tasks`,className:`inline-flex items-center gap-1 text-success`,children:[p.counts.ready,` ready`]}),p.counts.running>0&&(0,U.jsxs)(`span`,{title:`Running assignments`,className:`inline-flex items-center gap-1 text-warning`,children:[p.counts.running,` running`]}),p.counts.review>0&&(0,U.jsxs)(`span`,{title:`In review`,className:`inline-flex items-center gap-1 text-primary`,children:[p.counts.review,` review`]}),p.counts.blocked>0&&(0,U.jsxs)(`span`,{title:`Manually blocked`,className:`inline-flex items-center gap-1 text-destructive`,children:[p.counts.blocked,` blocked`]}),p.counts.failed>0&&(0,U.jsxs)(`span`,{title:`Failed tasks`,className:`inline-flex items-center gap-1 text-destructive`,children:[p.counts.failed,` failed`]}),p.dependencyBlocked.count>0&&(0,U.jsxs)(`span`,{title:`Ready/pending tasks blocked by dependencies`,className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[p.dependencyBlocked.count,` blocked by deps`]}),p.staleAssignments.count>0&&(0,U.jsxs)(`span`,{title:`Expired lease assignments`,className:`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[p.staleAssignments.count,` stale`]}),p.heartbeatDue.count===0&&p.staleAssignments.count===0&&p.dependencyBlocked.count===0&&(0,U.jsx)(`span`,{className:`text-success`,children:`healthy`}),Me>0&&(0,U.jsxs)(`span`,{title:`Sum of costCeilingUsd for running/queued tasks`,className:`inline-flex items-center gap-1 text-info`,children:[`~$`,Me.toFixed(2),` running cost`]})]}),(0,U.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,U.jsx)(Jt,{board:u,column:e,selectedTaskId:E,dragTaskId:Se,setDragTaskId:Ce,onSelectTask:ae,onDeleteTask:Re,onMoveTask:V},e.id))})]}):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`No kanban board selected.`})})]}),(0,U.jsx)(Zt,{boards:i,board:u,task:we,runLink:Pe,onClose:()=>ae(null),sendKanban:F,sendRaw:Ne,refreshBoard:L,activityEvents:D,activityPresence:se,activityLoading:de,activityError:me,activitySessionId:u?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>_e(e=>e+1)})]})}function Wt({runLink:e,sendRaw:n}){let r=e.engine===`sdd`,i=r?`sdd.board`:`goal`,a=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase text-primary`,children:[(0,U.jsx)(T,{size:11}),` `,e.engine]}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Live run — steer it from here`}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsxs)(`button`,{type:`button`,className:a,onClick:()=>n(`${i}.pause`),children:[(0,U.jsx)(oe,{size:12}),` Pause`]}),(0,U.jsxs)(`button`,{type:`button`,className:a,onClick:()=>n(`${i}.resume`),children:[(0,U.jsx)(ae,{size:12}),` Resume`]}),r&&(0,U.jsxs)(`button`,{type:`button`,className:a,onClick:()=>n(`sdd.board.retry_all_failed`),children:[(0,U.jsx)(t,{size:12}),` Retry failed`]}),(0,U.jsxs)(`button`,{type:`button`,className:O(a,`text-destructive hover:bg-destructive/10`),onClick:()=>n(`${i}.stop`),children:[(0,U.jsx)(d,{size:12}),` Stop`]})]})]})}function Gt({boardId:e,sendKanban:t}){let n=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium text-primary hover:bg-primary/10`;return(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,U.jsx)(T,{size:13,className:`text-primary`}),(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Run this board as a live agent job:`}),(0,U.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,U.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:`Start as Goal`}),(0,U.jsx)(`button`,{type:`button`,className:n,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:`Start as SDD`})]})]})}function Kt({runLink:e,runTaskId:n,modelCandidates:r,sendRaw:i}){let a=e.engine===`sdd`,[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(``),u=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,p=()=>{let e=c.trim();e&&(i(a?`sdd.board.reassign`:`goal.assignTask`,{taskId:n,agentName:e}),s(!1),l(``))};return(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Run controls`}),a&&(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Worker model`}),(0,U.jsx)(Ce,{candidates:r,placeholder:`Set model for this task…`,onPick:(e,t)=>i(`sdd.board.set_task_model`,{taskId:n,model:e,provider:t})})]}),o?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p(),e.key===`Escape`&&s(!1)},placeholder:`New worker name`,className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:p,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,U.jsx)(f,{size:14})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,U.jsx)(le,{size:14})})]}):(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(a?`sdd.board.retry`:`goal.retryTask`,{taskId:n}),children:[(0,U.jsx)(t,{size:13}),` Retry`]}),(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>s(!0),children:[(0,U.jsx)(ne,{size:13}),` Reassign`]}),a?(0,U.jsxs)(`button`,{type:`button`,className:O(u,`text-destructive hover:bg-destructive/10`),onClick:()=>i(`sdd.board.cancel_task`,{taskId:n}),children:[(0,U.jsx)(d,{size:13}),` Cancel`]}):(0,U.jsxs)(`button`,{type:`button`,className:u,onClick:()=>i(`goal.runTask`,{taskId:n}),children:[(0,U.jsx)(ae,{size:13}),` Run now`]})]})]})}function qt(e,t){let n=t.assignment,r=Pt(e,t,[]).findings.filter(e=>e.category===`operational`),i=H(n?.provider),a=H(n?.model);return{owner:H(n?.name)??H(n?.agentId)??H(n?.role)??H(t.assignee)??H(t.assignedAgent)??`Unassigned`,route:i||a?`${i?`${i}/`:``}${a??`default`}`:n?.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:n?.attempt?`${n.attempt}${n.maxAttempts?`/${n.maxAttempts}`:``}`:`0`,fallbackCount:+!!n?.fallbackProfile+(n?.fallbackModels?.length??0),activeUsers:(e.presence??[]).filter(e=>e.taskId===t.id&&e.active).length,failed:t.status===`failed`||n?.status===`failed`||!!n?.error,criticalRisks:r.filter(e=>e.severity===`critical`).length,warningRisks:r.filter(e=>e.severity===`warning`).length}}function Jt({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:o,onDeleteTask:s,onMoveTask:c}){let l=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,U.jsxs)(`section`,{className:O(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,l.length===0?`w-[180px]`:`w-[310px]`),children:[(0,U.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,U.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,U.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:l.length})]}),(0,U.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragOver:e=>e.preventDefault(),onDrop:n=>{n.preventDefault(),e.lifecycle?.mode!==`managed`&&r&&c(r,t.id),i(null)},children:l.map(t=>{let r=qt(e,t);return(0,U.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&i(t.id)},onDragEnd:()=>i(null),className:O(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,n===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>o(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t.atomic&&(0,U.jsx)(`span`,{className:`shrink-0 rounded bg-warning/15 px-1 py-0.5 text-[10px] font-medium text-warning`,children:`atomic`}),(0,U.jsx)(`span`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title})]}),t.description&&(0,U.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,U.jsx)(`button`,{type:`button`,title:`Delete task`,"aria-label":`Delete task: ${t.title}`,onClick:()=>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,U.jsx)(a,{size:14})})]}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,U.jsx)(`span`,{className:rn(t.priority),children:t.priority}),(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),r.owner!==`Unassigned`&&(0,U.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:r.owner}),t.assignment&&(0,U.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:r.route}),t.assignment?.attempt?(0,U.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,r.attempts]}):null,r.fallbackCount>0&&(0,U.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.fallbackCount,` fallback`]}),r.blockers>0?(0,U.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.blockers,` blocker`]}):null,r.activeUsers>0&&(0,U.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[r.activeUsers,` active`]}),r.failed&&(0,U.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:`run failed`}),r.criticalRisks>0&&(0,U.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[r.criticalRisks,` critical risk`]}),r.warningRisks>0&&(0,U.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.warningRisks,` warning`]}),t.chain&&(0,U.jsxs)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:[`chain `,t.chain.order+1]}),t.assignment?.skills?.length?(0,U.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[t.assignment.skills.length,` skills`]}):null]})]},t.id)})})]})}var Yt=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Xt=[{value:`fs.read`,label:`Read files`,description:`fs.read`},{value:`fs.write`,label:`Write files (in project)`,description:`fs.write`},{value:`fs.write.outside-project`,label:`Write outside project`,description:`fs.write.outside-project`},{value:`net.outbound`,label:`Outbound network`,description:`net.outbound`},{value:`shell.exec`,label:`Run project commands`,description:`shell.exec`},{value:`shell.restricted`,label:`Restricted shell`,description:`shell.restricted`},{value:`shell.arbitrary`,label:`Arbitrary shell`,description:`shell.arbitrary`},{value:`session.todo`,label:`Session todos`,description:`session.todo`},{value:`tool.meta`,label:`Tool metadata`,description:`tool.meta`},{value:`tool.mutate.any`,label:`Invoke any tool`,description:`tool.mutate.any`},{value:`memory.read`,label:`Read memory`,description:`memory.read`},{value:`memory.write`,label:`Write memory`,description:`memory.write`},{value:`package.install`,label:`Install packages`,description:`package.install`},{value:`subagent.spawn`,label:`Spawn subagents`,description:`subagent.spawn`},{value:`config.mutate`,label:`Mutate config / trust`,description:`config.mutate`}];function Zt({boards:e,board:t,task:n,runLink:r,onClose:a,sendKanban:s,sendRaw:c,refreshBoard:u,activityEvents:d,activityPresence:p,activityLoading:h,activityError:g,activitySessionId:_,refreshActivity:v}){let[y,x]=(0,N.useState)(``),[S,C]=(0,N.useState)(``),[w,T]=(0,N.useState)(``),[te,re]=(0,N.useState)(``),[E,ae]=(0,N.useState)(``),[D,oe]=(0,N.useState)(`session`),[se,ue]=(0,N.useState)(``),[de,fe]=(0,N.useState)([]),[pe,me]=(0,N.useState)([]),[ge,_e]=(0,N.useState)([]),[ve,ye]=(0,N.useState)([]),[k,be]=(0,N.useState)(``),xe=Se(!!n),A=we(!!n),j=H(A.sessionProvider),Te=H(A.sessionModel),Ee=M(`kanban-task-inspector`,!!n),[De,Oe]=(0,N.useState)(!1),[P,ke]=(0,N.useState)(!1),[Ae,je]=(0,N.useState)(``),[Me,F]=(0,N.useState)(``),[Ne,Pe]=(0,N.useState)(``),[I,L]=(0,N.useState)(`pending`),[Fe,R]=(0,N.useState)(``),[Ie,z]=(0,N.useState)(``),[B,Le]=(0,N.useState)(``),[Re,V]=(0,N.useState)(`medium`),[ze,Be]=(0,N.useState)(`chore`),[Ve,Ue]=(0,N.useState)(``),[We,Ge]=(0,N.useState)([]),[qe,Je]=(0,N.useState)([]),[Ye,Xe]=(0,N.useState)(!1),[W,G]=(0,N.useState)(``),[K,Ze]=(0,N.useState)(``),[Qe,$e]=(0,N.useState)(`off`),[et,tt]=(0,N.useState)(``),[nt,rt]=(0,N.useState)(``),[it,ot]=(0,N.useState)(``),[q,st]=(0,N.useState)(``),[ct,lt]=(0,N.useState)(``),[ut,dt]=(0,N.useState)(`observation`),[ft,pt]=(0,N.useState)(`unknown`),[ht,J]=(0,N.useState)(``);(0,N.useEffect)(()=>{let r=H(n?.assignment?.provider),i=H(n?.assignment?.model);x(H(n?.assignment?.agentId)??H(n?.assignedAgent)??``),C(H(n?.assignment?.name)??``),T(H(n?.assignment?.role)??``),re(r??``),ae(i??``),oe(n?.assignment?.modelRouting??(r||i?`fixed`:`session`)),ue(H(n?.assignment?.fallbackProfile)??``),fe(n?.assignment?.fallbackModels??[]),me(n?.assignment?.skills??[]),_e(n?.assignment?.tools??[]),ye(n?.assignment?.allowedCapabilities??[]),be(e.find(e=>e.id!==t?.id)?.id??``),je(n?.title??``),F(n?.description??``),Pe(n?.dueDate??``),L(n?.status??`pending`),R(``),z(``),Le(``),V(n?.priority??`medium`),Be(n?.type??`chore`),Ue(n?.labels?.join(`, `)??``),Ge(n?.dependsOn??[]),Je(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]:[]),Xe(!1),G(n?.estimatedHours?.toString()??``),Ze(n?.actualHours?.toString()??``),$e(n?.retryPolicy??n?.assignment?.retryPolicy??`off`),tt((n?.costCeilingUsd??n?.assignment?.costCeilingUsd)?.toString()??``),rt(n?.assignment?.maxAttempts?.toString()??``),ot(``),st(``),lt(``),dt(`observation`),pt(`unknown`),J(``)},[t?.id,e,n]);let gt=e=>({boardId:t?.id,taskId:n?.id,...y.trim()?{agentId:y.trim()}:{},...S.trim()?{name:S.trim()}:{},...w.trim()?{role:w.trim()}:{},modelRouting:D,...D===`fixed`&&te.trim()?{provider:te.trim()}:{},...D===`fixed`&&E.trim()?{model:E.trim()}:{},...D===`fallback_profile`&&se.trim()?{fallbackProfile:se.trim()}:{},fallbackModels:de,skills:pe,tools:ge,allowedCapabilities:ve,...nt?{maxAttempts:Number(nt)}:{},...et?{costCeilingUsd:Number(et)}:{},retryPolicy:Qe,activityNote:ht.trim()||`${e===`dispatch`?`Dispatched`:`Assigned`} from WebUI to ${S.trim()||y.trim()||w.trim()||`the configured agent route`}.`}),_t=()=>{!t||!n||!Ae.trim()||(s(`kanban.task.update`,{boardId:t.id,taskId:n.id,title:Ae.trim(),description:Me,dueDate:Ne||null,...t.lifecycle?.mode===`managed`?{}:{status:I},priority:Re,type:ze,labels:Ve.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:We,...n.chain&&qe.length<=1?{chain:null}:{},estimatedHours:W?Number(W):0,actualHours:K?Number(K):0,retryPolicy:Qe,costCeilingUsd:et?Number(et):null,activityNote:ht.trim()||`Task contract edited in WebUI.`}),qe.length>1&&s(`kanban.task.chain`,{boardId:t.id,taskIds:qe,enforceDependencies:Ye}),window.setTimeout(()=>u(t.id),180),J(``))},Y=[`backlog`,`todo`,`running`,`review`,`done`],vt=n?.lifecycle?.currentStage,X=vt?Y.indexOf(vt):-1,Z=X>=0&&X<Y.length-1?Y[X+1]:void 0,yt=()=>{!t||!n||!Z||!Fe.trim()||(s(`kanban.task.transition`,{boardId:t.id,taskId:n.id,to:Z,actor:y.trim()||S.trim()||n.assignee||n.assignedAgent||`webui-agent`,comment:Fe.trim(),...Ie.trim()?{action:Ie.trim()}:{},...B.trim()?{attachment:{url:B.trim(),type:`url`,title:`Evidence for ${n.title}`}}:{}}),window.setTimeout(()=>u(t.id),180))},xt=()=>{!t||!n||!it.trim()||(s(`kanban.task.check.add`,{boardId:t.id,taskId:n.id,description:it.trim(),checkType:`manual`}),ot(``))},St=()=>{!t||!n||!q.trim()||(s(`kanban.task.activity.add`,{boardId:t.id,taskId:n.id,kind:ut,outcome:ft,summary:q.trim(),...ct.trim()?{details:ct.trim()}:{},actor:S.trim()||y.trim()||`webui-operator`}),st(``),lt(``),window.setTimeout(v,150))};return n?(0,U.jsxs)(`aside`,{"aria-label":`Task inspector`,"data-expanded":P?`true`:`false`,className:O(`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`,P?`fixed inset-0 z-50 h-dvh max-h-none w-screen border-0 bg-card transition-none md:w-screen md:border-0`:`md:w-[420px] xl:w-[480px]`),children:[(0,U.jsxs)(`div`,{className:O(`flex h-12 items-center gap-2 border-b px-3`,P&&`px-5`),children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:`Task`}),(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:n.id.slice(0,8)})]}),(0,U.jsx)(`button`,{type:`button`,title:P?`Collapse task details`:`Expand task details`,"aria-label":P?`Collapse task details`:`Expand task details`,"aria-pressed":P,onClick:()=>ke(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:P?(0,U.jsx)(ie,{size:16}):(0,U.jsx)(m,{size:16})}),(0,U.jsx)(`button`,{type:`button`,title:`Close`,onClick:()=>{ke(!1),a()},className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,U.jsx)(le,{size:16})})]}),n?(0,U.jsxs)(`div`,{ref:Ee,className:O(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,P&&`px-5 py-4 xl:px-7`),children:[(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,U.jsx)(Ke,{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(()=>u(t.id),150))}}),(0,U.jsx)(Q,{label:`Title`,value:Ae,onChange:je}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Description / working context`}),(0,U.jsx)(`textarea`,{value:Me,onChange:e=>F(e.target.value),rows:5,className:`w-full resize-y rounded-md border bg-background px-2 py-1.5 text-xs leading-5 outline-none focus:border-primary`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,U.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Managed stage`}),(0,U.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:n.lifecycle?.currentStage??`Backlog`})]}):(0,U.jsx)($,{label:`Status`,value:I,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>L(e)}),(0,U.jsx)($,{label:`Priority`,value:Re,options:[`critical`,`high`,`medium`,`low`],onChange:e=>V(e)}),(0,U.jsx)($,{label:`Type`,value:ze,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>Be(e)}),(0,U.jsx)(Q,{label:`Labels (comma separated)`,value:Ve,onChange:Ue})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)(Q,{label:`Due date (ISO or YYYY-MM-DD)`,value:Ne,onChange:Pe}),(0,U.jsx)(Q,{label:`Estimated hours`,value:W,onChange:G}),(0,U.jsx)(Q,{label:`Actual hours`,value:K,onChange:Ze})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Dependencies`}),(0,U.jsx)(He,{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,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Task chain (selection order)`}),(0,U.jsx)(He,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:qe,onChange:e=>Je(e.includes(n.id)?e:[n.id,...e]),placeholder:`Add tasks to a sequential chain…`}),(0,U.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:Ye,onChange:e=>Xe(e.target.checked)}),`Enforce chain order as dependencies`]})]}),(0,U.jsx)(Q,{label:`Change / assignment reason (persisted to activity)`,value:ht,onChange:J}),(0,U.jsxs)(`button`,{type:`button`,onClick:_t,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,U.jsx)(b,{size:15}),` Save task contract`]}),t?.lifecycle?.mode===`managed`&&Z&&(0,U.jsxs)(`section`,{"aria-label":`Managed lifecycle transition`,className:`space-y-2 rounded-md border border-primary/30 bg-primary/5 p-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:`Kanban Agent transition`}),(0,U.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[vt,` → `,Z,`; no stages can be skipped.`]})]}),(0,U.jsx)(i,{size:16,className:`text-primary`})]}),(0,U.jsx)(Q,{label:`Completed action / reviewer action`,value:Ie,onChange:z}),(0,U.jsx)(Q,{label:`Truthful progress comment (required)`,value:Fe,onChange:R}),(0,U.jsx)(Q,{label:`Evidence attachment URL`,value:B,onChange:Le}),(0,U.jsxs)(`button`,{type:`button`,disabled:!Fe.trim(),onClick:yt,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,U.jsx)(he,{size:15}),` Advance to `,Z]})]})]}),t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(bt,{board:t,task:n,events:d,presence:p,sessionId:_,sessionProvider:j,sessionModel:Te}),(0,U.jsx)(mt,{task:n,events:d,sessionId:_}),(0,U.jsx)(It,{board:t,task:n,events:d})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,U.jsx)(nn,{label:`Source`,value:n.origin?.system??`manual`}),(0,U.jsx)(nn,{label:`Task ID`,value:n.id.slice(0,8)}),(0,U.jsx)(nn,{label:`Run`,value:n.assignment?.status??`unassigned`}),(0,U.jsx)(nn,{label:`Column`,value:Qt(t,n.columnId)})]}),n.assignment&&(0,U.jsx)(tn,{assignment:n.assignment}),r&&n.origin?.taskId&&(0,U.jsx)(Kt,{runLink:r,runTaskId:n.origin.taskId,modelCandidates:xe,sendRaw:c}),!r&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)($,{label:`Primary model source`,value:D,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>oe(e)}),D===`session`&&(0,U.jsxs)(`div`,{className:`rounded-md border bg-info/5 px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Uses the live session model: `,j?`${j}/`:``,Te||`not available`,`.`]}),D===`fixed`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fixed provider / model`}),(0,U.jsx)(Ce,{value:E||void 0,provider:te||void 0,candidates:xe,placeholder:`Select exact provider / model…`,onPick:(e,t)=>{ae(e),re(t)}})]}),D===`fallback_profile`&&(0,U.jsx)($,{label:`Fallback profile (first model is primary)`,value:se,options:Object.keys(A.fallbackProfiles),placeholder:`Select configured profile…`,onChange:ue}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Fallback models`}),(0,U.jsx)(He,{options:xe.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:de,onChange:fe,placeholder:`Add fallback model…`,emptyLabel:`No models — add a provider in Settings`})]}),(0,U.jsx)($,{label:`Role`,value:w,options:Yt,placeholder:`Select a role…`,onChange:T}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· force-loaded into the worker`})]}),(0,U.jsx)(He,{options:A.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:pe,onChange:me,placeholder:`Assign required skills…`,emptyLabel:`No skills registered`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = full default toolset`})]}),(0,U.jsx)(He,{options:A.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:ge,onChange:_e,placeholder:`Restrict to specific tools…`,emptyLabel:`Tool list unavailable on this server`})]}),(0,U.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>Oe(e=>!e),className:`flex w-full items-center justify-between px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[`Advanced`,(0,U.jsx)(o,{size:13,className:O(`transition-transform`,De&&`rotate-180`)})]}),De&&(0,U.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,U.jsx)(Q,{label:`Agent name (optional)`,value:S,onChange:C}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsx)($,{label:`Retry policy`,value:Qe,options:[`off`,`incremental`,`exponential`],onChange:e=>$e(e)}),(0,U.jsx)(Q,{label:`Max attempts`,value:nt,onChange:rt}),(0,U.jsx)(Q,{label:`Cost ceiling USD`,value:et,onChange:tt})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`· blank = safe defaults`})]}),(0,U.jsx)(He,{options:Xt,selected:ve,onChange:ye,placeholder:`Grant a capability…`})]})]})]})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(s(`kanban.task.assign`,gt(`assign`)),J(``),window.setTimeout(()=>u(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,U.jsx)(ne,{size:15}),`Assign`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||(s(`kanban.task.dispatch`,gt(`dispatch`)),J(``),window.setTimeout(()=>u(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,U.jsx)(l,{size:15}),`Dispatch`]})]})]}),e.length>1&&!r?(0,U.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:`Target board`}),(0,U.jsx)(`select`,{value:k,onChange:e=>be(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:e.filter(e=>e.id!==t?.id).map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!k||s(`kanban.task.copy`,{boardId:t.id,taskId:n.id,targetBoardId:k})},disabled:!k,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,U.jsx)(ce,{size:15}),`Copy`]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!n||!k||s(`kanban.task.transfer`,{boardId:t.id,taskId:n.id,targetBoardId:k})},disabled:!k,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,U.jsx)(he,{size:15}),`Transfer`]})]})]}):null,(0,U.jsxs)(`div`,{className:`mt-5`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Completion checks`}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(n.successCriteria??[]).map(e=>(0,U.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_92px] items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs`,children:[(0,U.jsx)(f,{size:13,className:e.status===`passed`?`text-success`:`text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.description}),(0,U.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,U.jsx)(`option`,{value:e,children:e},e))})]},e.id)),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(`input`,{value:it,onChange:e=>ot(e.target.value),onKeyDown:e=>e.key===`Enter`&&xt(),placeholder:`Add a verifiable completion check…`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:xt,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,U.jsx)(ee,{size:14})})]})]})]}),n.verificationReport&&(0,U.jsx)(At,{report:n.verificationReport}),(0,U.jsx)(at,{task:n,events:d,sessionId:_,loading:h,error:g,onRefresh:v}),(0,U.jsxs)(`div`,{className:`mt-4`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:`Record decision / outcome`}),(0,U.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,U.jsx)(`select`,{value:ut,onChange:e=>dt(e.target.value),"aria-label":`Task activity kind`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`decision`,`attempt`,`result`,`blocker`,`observation`].map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))}),(0,U.jsx)(`select`,{value:ft,onChange:e=>pt(e.target.value),"aria-label":`Task activity outcome`,className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`unknown`,`succeeded`,`failed`,`partial`,`skipped`].map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))})]}),(0,U.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,U.jsx)(`input`,{value:q,onChange:e=>st(e.target.value),onKeyDown:e=>e.key===`Enter`&&St(),placeholder:`What was decided, attempted, or produced?`,className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,U.jsx)(`button`,{type:`button`,onClick:St,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":`Record task decision or outcome`,children:(0,U.jsx)(ee,{size:14})})]}),(0,U.jsx)(`input`,{value:ct,onChange:e=>lt(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 Qt(e,t){return e?.columns.find(e=>e.id===t)?.title??t}var $t={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 en(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 tn({assignment:e}){let t=e.status===`running`,n=en(e.dispatchedAt,e.completedAt),r=H(e.name)??H(e.agentId),i=H(e.role),a=H(e.provider),o=H(e.model),s=[];return r&&s.push({label:`Agent`,value:r}),i&&s.push({label:`Role`,value:i}),e.modelRouting&&s.push({label:`Model source`,value:e.modelRouting}),(a||o)&&s.push({label:`Model`,value:(0,U.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[a?`${a}/`:``,o??`—`]})}),e.subagentId&&s.push({label:`Subagent`,value:(0,U.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),n&&s.push({label:e.completedAt?`Duration`:`Elapsed`,value:n}),typeof e.attempt==`number`&&s.push({label:`Attempt`,value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&s.push({label:`Cost ceiling`,value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&s.push({label:`Fallback profile`,value:e.fallbackProfile}),e.fallbackModels?.length&&s.push({label:`Fallbacks`,value:e.fallbackModels.join(` → `)}),e.skills?.length&&s.push({label:`Skills`,value:e.skills.join(`, `)}),e.tools?.length&&s.push({label:`Tools`,value:e.tools.join(`, `)}),e.leaseExpiresAt&&s.push({label:`Lease expires`,value:new Date(e.leaseExpiresAt).toLocaleString()}),(0,U.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Live run`}),(0,U.jsxs)(`span`,{className:O(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,$t[e.status]??`bg-muted text-muted-foreground`),children:[t&&(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),s.length>0&&(0,U.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:s.map(e=>(0,U.jsxs)(`div`,{className:`contents`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,U.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:`Last result`}),(0,U.jsx)(`div`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap rounded bg-muted px-2 py-1 text-[11px] leading-relaxed text-foreground`,children:e.lastResult})]}),e.error&&(0,U.jsx)(`div`,{className:`mt-2 rounded border border-destructive/30 bg-destructive/10 px-2 py-1 text-[11px] text-destructive`,children:e.error})]})}function nn({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function Q({label:e,value:t,onChange:n}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`})]})}function $({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,U.jsxs)(`select`,{value:t,onChange:e=>i(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:[r&&(0,U.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})]})}function rn(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{Ut 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-BmsAdDhb.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{Br as t,Oi as n,aa as r,ni as i,tt as a,ua as o}from"./vendor-BmsAdDhb.js";import"./i18n-c37VNlP9.js";import{s}from"./monaco-C7izDJhg.js";import{t as c}from"./utils-DvgvNCoT.js";import{d as l}from"./markdown-L6DLSM7f.js";var u=e(o(),1),d=a();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}=r(),[a,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`,a?`text-success`:`text-muted-foreground hover:text-foreground`),title:t(a?`common:action.copied`:`common:action.copy`),children:[a?(0,d.jsx)(n,{className:`h-3 w-3`}):(0,d.jsx)(i,{className:`h-3 w-3`}),(0,d.jsx)(`span`,{children:t(a?`common:action.copied`:`common:action.copy`)})]})}var b={code({inline:e,className:n,children:r,...i}){let a=/language-(\w+)/.exec(n??``),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`,n),...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)(t,{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`,n),...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`,n),...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-BmsAdDhb.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{An as t,Ar as n,Bn as r,Dt as i,Fn as a,Kt as o,Qt as s,Vi as c,Yi as l,aa as u,bi as d,ca as f,ci as p,fi as m,fr as h,gi as g,mt as _,nn as v,ot as y,qt as b,tt as x,ua as S}from"./vendor-BmsAdDhb.js";import"./i18n-c37VNlP9.js";import{n as C}from"./ui-store-DxFtiYFb.js";import{t as w}from"./utils-DvgvNCoT.js";import{t as T}from"./mailbox-store-DSvN5ZEo.js";import{s as E}from"./view-navigation-D8lN47bJ.js";import{s as D,t as O}from"./LazyMarkdown-DWlQpo_8.js";import{t as k}from"./empty-state-DJc37Wg1.js";var A=e(S(),1),j=x(),M={note:n,ask:g,assign:o,steer:s,btw:c,broadcast:o,status:m,result:d,review:b},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?f.t(`common:time.justNow`):n<36e5?f.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?f.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?f.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t}=u(),n=Object.entries(e);return n.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-success/10 text-success`,title:P(t),children:[(0,j.jsx)(d,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:n}=u(),o=C(e=>e.selectedMailMessage),s=C(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{s(null)},[s]);function c(){s(null),E(`chat`)}if(!o)return(0,j.jsx)(k,{icon:(0,j.jsx)(a,{className:`h-6 w-6`}),title:n(`activity:mailbox.emptyDetail`),description:n(`activity:mailbox.emptyDetailHint`)});let f=M[o.type]??t,m=n(`activity:mailbox.type.${o.type}`,{defaultValue:o.type}),g=N[o.priority]??N.normal,b=o.scope?{scope:o.scope,recipientSessionId:o.recipientSessionId}:T(o.to),x=o.to===`*`||o.to===`all`?n(`activity:mailbox.everyone`):o.to,S=b.scope===`session`?n(`activity:mailbox.sessionScope`,{sid:b.recipientSessionId??``}):b.scope===`project`?n(`activity:mailbox.projectScope`):n(`activity:mailbox.directScope`);return(0,j.jsx)(`div`,{className:w(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/70 px-3 py-3 sm:px-4 shrink-0`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:c,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:mailbox.backToChat`),children:(0,j.jsx)(l,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className:w(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,o.completed?`bg-success/10`:`bg-primary/10`),children:(0,j.jsx)(f,{className:w(`h-4 w-4`,o.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:o.subject}),o.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)(d,{className:`h-3 w-3`}),n(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:w(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:o.priority||`normal`}),o.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)(r,{className:`h-2.5 w-2.5`}),` `,n(`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:o.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:n(`activity:mailbox.sessionScopeTitle`,{sid:b.recipientSessionId??``}),children:[(0,j.jsx)(r,{className:`h-2.5 w-2.5`}),n(`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)(h,{className:`h-2.5 w-2.5`}),n(`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)(p,{className:`h-3 w-3`}),F(o.timestamp)]})]})]}),(0,j.jsx)(`button`,{type:`button`,onClick:c,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:n(`activity:mailbox.closeTitle`),children:(0,j.jsx)(y,{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:o.body})})})}),(0,j.jsxs)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-3 shrink-0`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(i,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:m})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:w(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:o.priority||`normal`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(_,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,title:o.from,children:o.from})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[b.scope===`session`?(0,j.jsx)(r,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(h,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:n(`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)(p,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:P(o.timestamp)})]}),o.replyTo&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(v,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:n(`activity:mailbox.replyTo`,{id:o.replyTo})})]}),o.completed&&o.completedBy&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(d,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:o.completedAt?n(`activity:mailbox.completedByAt`,{name:o.completedBy,time:P(o.completedAt)}):n(`activity:mailbox.completedBy`,{name:o.completedBy})})]}),o.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:n(`activity:mailbox.outcome`)}),(0,j.jsx)(`span`,{children:o.outcome})]}),o.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:n(`activity:mailbox.task`)}),(0,j.jsx)(`span`,{children:o.taskContext})]})]}),Object.keys(o.readBy??{}).length>0&&(0,j.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,j.jsx)(I,{readBy:o.readBy})})]})]})})}export{L as MailboxDetailView};
|