@wrongstack/webui 0.299.0 → 0.301.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/assets/AgentRosterView-BV6ysoGs.js +9 -0
- package/dist/assets/{AnalyticsDashboard-D58kSekC.js → AnalyticsDashboard-UWNP8zjE.js} +1 -1
- package/dist/assets/AudienceMemoryPanel-DwDKbvSA.js +3 -0
- package/dist/assets/ChangesView-DuVlGWkD.js +1 -0
- package/dist/assets/ChronicleDashboard-cs16n708.js +1 -0
- package/dist/assets/CodeEditor-sr50ljZN.js +1 -0
- package/dist/assets/CodeMap-CtK-C8gK.js +1 -0
- package/dist/assets/ConfirmModal-ndS17YwF.js +1 -0
- package/dist/assets/CronJobsPanel-Dovomns5.js +1 -0
- package/dist/assets/DeadCodeScanPanel-DjR4LLMs.js +2 -0
- package/dist/assets/DebugDashboard-jK1yp3qS.js +1 -0
- package/dist/assets/DesignGalleryView-CqXlEUzE.js +1 -0
- package/dist/assets/GoalView-CGNLrnA4.js +1 -0
- package/dist/assets/KanbanView--tAf_K7N.js +3 -0
- package/dist/assets/{MailboxDetailView-ZcKcOEAe.js → MailboxDetailView-0TBzZTdN.js} +1 -1
- package/dist/assets/MemoryManager-CDK_MO8A.js +1 -0
- package/dist/assets/{ModelPicker-DvNLZzkm.js → ModelPicker-BbBZuQwR.js} +1 -1
- package/dist/assets/OfficeMapPanel-68sVzHRD.js +4 -0
- package/dist/assets/OfficeMapPanel-D6yTfGIT.css +1 -0
- package/dist/assets/{ProcessMonitor-2nSk6sXA.js → ProcessMonitor-gFwiF8gX.js} +1 -1
- package/dist/assets/{QueuePanel-4KBBWFxj.js → QueuePanel-Cx-isRGl.js} +1 -1
- package/dist/assets/{RefreshDebugView-D3XnE53y.js → RefreshDebugView-C9tdu6Ld.js} +1 -1
- package/dist/assets/RequirementIntakeView-cPEw-RpV.js +1 -0
- package/dist/assets/SageTabs-BbK6VFO0.js +2 -0
- package/dist/assets/SddHub-NKvDRECi.js +2 -0
- package/dist/assets/SessionInspectView-DPG5qWhj.js +1 -0
- package/dist/assets/SessionList-ncl-20X_.js +1 -0
- package/dist/assets/SessionsDashboard-D23UVLr4.js +1 -0
- package/dist/assets/SetupScreen-D3XQ8MGk.js +1 -0
- package/dist/assets/{SkillDetailView-D7EQ2XtV.js → SkillDetailView-DDPhVFet.js} +1 -1
- package/dist/assets/SpecsView-afIS0QpX.js +1 -0
- package/dist/assets/TechStackView-kQ2OGxxw.js +1 -0
- package/dist/assets/{TerminalPanel-BL9ZPGJt.js → TerminalPanel-GcJWeldW.js} +1 -1
- package/dist/assets/{Toaster-CJI70aa-.js → Toaster-CgQA9256.js} +1 -1
- package/dist/assets/activity-B-cvKIfT.js +9 -0
- package/dist/assets/activity-Ba3aMzvo.js +9 -0
- package/dist/assets/activity-CRTVZ5A4.js +9 -0
- package/dist/assets/activity-DsSuflRW.js +9 -0
- package/dist/assets/activity-DxDRJ8kN.js +9 -0
- package/dist/assets/activity-VI776bUZ.js +9 -0
- package/dist/assets/activity-nVmsmqAI.js +9 -0
- package/dist/assets/chat-BPuAsrkF.js +1 -0
- package/dist/assets/chat-BfQBSiII.js +1 -0
- package/dist/assets/chat-BnkVCZ3Q.js +1 -0
- package/dist/assets/chat-CR2B97dj.js +1 -0
- package/dist/assets/chat-CdiY7G6Z.js +1 -0
- package/dist/assets/chat-DResBrkV.js +1 -0
- package/dist/assets/chat-Di8o0wDz.js +1 -0
- package/dist/assets/chat-store-DbxFVDwi.js +17 -0
- package/dist/assets/{common-DMM-xyW3.js → common-BXJbu5Y-.js} +1 -1
- package/dist/assets/{common-C9ikgX7d.js → common-BiNu_WzQ.js} +1 -1
- package/dist/assets/common-COVxQ0FV.js +1 -0
- package/dist/assets/{common-D29Zdkxb.js → common-Ch7JihXD.js} +1 -1
- package/dist/assets/{common-DoUBSHRY.js → common-DPaTeTls.js} +1 -1
- package/dist/assets/{common-vdwxzODB.js → common-DdGpRh8j.js} +1 -1
- package/dist/assets/{common-C5hY-d_0.js → common-pI6fYZW3.js} +1 -1
- package/dist/assets/i18n-COgumVF5.js +2 -0
- package/dist/assets/index-CtpViiZy.js +132 -0
- package/dist/assets/index-fIsq43fR.css +1 -0
- package/dist/assets/mailbox-store-C1mzoSqJ.js +1 -0
- package/dist/assets/{progress-ring-61A-xUEl.js → progress-ring-D_48qsBl.js} +1 -1
- package/dist/assets/{roster-ws-Dfg_187V.js → roster-ws-Da57e_sI.js} +1 -1
- package/dist/assets/session-store-Df7_hhe9.js +1 -0
- package/dist/assets/settings-Bb7_utQE.js +1 -0
- package/dist/assets/settings-Bd8zMwvC.js +1 -0
- package/dist/assets/settings-DdFgBMAw.js +1 -0
- package/dist/assets/settings-De6sXIFO.js +1 -0
- package/dist/assets/settings-E8SKMLxq.js +1 -0
- package/dist/assets/settings-zIY9-ivF.js +1 -0
- package/dist/assets/settings-zKBcRjqE.js +1 -0
- package/dist/assets/stores-ChEnUmic.js +7 -0
- package/dist/assets/ui-store-CE4-TlwB.js +1 -0
- package/dist/assets/useWebSocket-_gk4MRJz.js +29 -0
- package/dist/assets/{view-navigation-DxfiZrXS.js → view-navigation-DIDEcp4V.js} +1 -1
- package/dist/assets/ws-client-TTMa0XaT.js +1 -0
- package/dist/components/AgentCard.d.ts +21 -0
- package/dist/components/AgentsPage.d.ts +0 -3
- package/dist/components/AutonomyPicker.d.ts +1 -1
- package/dist/components/ChatInput/refine-panel-host.d.ts +2 -2
- package/dist/components/ChatView/auto-collapse.d.ts +42 -0
- package/dist/components/ConfirmModal.d.ts +7 -2
- package/dist/components/FallbackModal.d.ts +2 -0
- package/dist/components/KanbanBoardState.d.ts +1 -1
- package/dist/components/KanbanVerificationDashboard.d.ts +0 -6
- package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -3
- package/dist/components/SettingsPanel/ShadowSection.d.ts +18 -1
- package/dist/components/SettingsPanel/brain-section-options.d.ts +27 -55
- package/dist/components/TaskCard.d.ts +0 -1
- package/dist/components/TaskRiskPanel.d.ts +10 -3
- package/dist/components/TechStackView/shared.d.ts +11 -6
- package/dist/components/ThemeProvider.d.ts +6 -1
- package/dist/components/agent-roster-data.d.ts +2 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/hooks/useWebSocket.d.ts +10 -2
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts +1 -0
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +13 -0
- package/dist/hooks/ws-handlers/session-handlers.d.ts +1 -0
- package/dist/index.css +62 -0
- package/dist/index.html +18 -17
- package/dist/index.js +26640 -12728
- package/dist/lib/file-icons.d.ts +3 -3
- package/dist/lib/kanban-board-active.d.ts +19 -0
- package/dist/lib/palettes.d.ts +37 -0
- package/dist/lib/plugin-enablement.d.ts +1 -1
- package/dist/lib/ws-client.d.ts +24 -4
- package/dist/providers.json +7 -7
- package/dist/stores/config-store.d.ts +9 -1
- package/dist/stores/context-editor-store.d.ts +9 -1
- package/dist/stores/fallback-store.d.ts +30 -0
- package/dist/stores/fleet-store.d.ts +14 -1
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/local-prefs.d.ts +13 -0
- package/dist/stores/mailbox-store.d.ts +2 -0
- package/dist/stores/session-store.d.ts +9 -1
- package/dist/stores/ui-store.d.ts +2 -0
- package/dist/types/brain.d.ts +2 -0
- package/dist/types/client-message.d.ts +19 -2
- package/dist/types/protocol-core.d.ts +21 -0
- package/dist/types/runtime.d.ts +22 -0
- package/dist/types/server-message.d.ts +15 -4
- package/package.json +9 -9
- package/dist/assets/AgentRosterView-BqojERFR.js +0 -11
- package/dist/assets/AudienceMemoryPanel-Cc1UkbDl.js +0 -3
- package/dist/assets/ChangesView-BKU80ANq.js +0 -1
- package/dist/assets/ChronicleDashboard-CvCS1Dj1.js +0 -1
- package/dist/assets/CodeEditor-BHZQhx_8.js +0 -1
- package/dist/assets/CodeMap-qllGEFLB.js +0 -1
- package/dist/assets/CronJobsPanel-DD5mhZ4Q.js +0 -1
- package/dist/assets/DeadCodeScanPanel-PB-c8et_.js +0 -2
- package/dist/assets/DebugDashboard-Q8QiVflQ.js +0 -1
- package/dist/assets/DesignGalleryView-CGOtWO7s.js +0 -1
- package/dist/assets/GoalView-Dlk42vW7.js +0 -1
- package/dist/assets/KanbanView-DIP6kKmU.js +0 -3
- package/dist/assets/MemoryManager-B7620q_K.js +0 -1
- package/dist/assets/OfficeMapPanel-BFIF-EMt.css +0 -1
- package/dist/assets/OfficeMapPanel-DKJNTtOZ.js +0 -4
- package/dist/assets/RequirementIntakeView-BMxlf8bt.js +0 -1
- package/dist/assets/SageTabs-g1hO2hJ0.js +0 -2
- package/dist/assets/SddHub-Kv_TbTgT.js +0 -2
- package/dist/assets/SessionInspectView-PnKTvyvP.js +0 -1
- package/dist/assets/SessionList-BeinIC-h.js +0 -1
- package/dist/assets/SessionsDashboard-DEG_BylE.js +0 -1
- package/dist/assets/SetupScreen-DxJwZ1OZ.js +0 -1
- package/dist/assets/SpecsView-Fm7pYYcj.js +0 -1
- package/dist/assets/TechStackView-Bo_UenRF.js +0 -1
- package/dist/assets/activity-BCgOEWgR.js +0 -5
- package/dist/assets/activity-BQ0zqkw2.js +0 -5
- package/dist/assets/activity-CAovbq3e.js +0 -5
- package/dist/assets/activity-CFQyCvgu.js +0 -5
- package/dist/assets/activity-CdQf7zRK.js +0 -5
- package/dist/assets/activity-DACvyn2-.js +0 -5
- package/dist/assets/activity-DOwYydU-.js +0 -5
- package/dist/assets/chat-CRmMDzCb.js +0 -1
- package/dist/assets/chat-CwnuX7tG.js +0 -1
- package/dist/assets/chat-DLn1hY01.js +0 -1
- package/dist/assets/chat-DSEq1Bdz.js +0 -1
- package/dist/assets/chat-DxLD17ER.js +0 -1
- package/dist/assets/chat-DzPxYALH.js +0 -1
- package/dist/assets/chat-OunddzYy.js +0 -1
- package/dist/assets/chat-store-CtOyUCdF.js +0 -17
- package/dist/assets/common-BfVFjVhf.js +0 -1
- package/dist/assets/i18n-B0hsnanh.js +0 -2
- package/dist/assets/index-DHdO0CRE.js +0 -132
- package/dist/assets/index-DKrFQ76m.css +0 -1
- package/dist/assets/mailbox-store-D8TvJsuk.js +0 -1
- package/dist/assets/session-store-b2KGFwkX.js +0 -1
- package/dist/assets/settings-B5xal2R3.js +0 -1
- package/dist/assets/settings-BHtFy8EG.js +0 -1
- package/dist/assets/settings-Bss5hBla.js +0 -1
- package/dist/assets/settings-BzrLCVRP.js +0 -1
- package/dist/assets/settings-C7RdvmLZ.js +0 -1
- package/dist/assets/settings-Dd94HoV6.js +0 -1
- package/dist/assets/settings-Dm9THFe8.js +0 -1
- package/dist/assets/stores-BptlyD_v.js +0 -7
- package/dist/assets/ui-store-BsBnjO3w.js +0 -1
- package/dist/assets/useWebSocket-Bc4S0N4r.js +0 -29
- package/dist/assets/ws-client-DqFoX4jJ.js +0 -1
- package/dist/components/AgentsMonitor.d.ts +0 -26
- package/dist/components/FleetMonitor.d.ts +0 -21
- package/dist/lib/accent-colors.d.ts +0 -136
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Na as t,Pa as n,lt as r,za as i}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-ftgTihmF.js";import{t as d}from"./button-Dcy288Mc.js";import{t as f}from"./input-fo9-BPBC.js";var p=e(i(),1),m=r(),h=t()((e,t)=>({request:null,open:n=>{t().request?.resolve(!1),e({request:n})},settle:n=>{t().request?.resolve(n),e({request:null})}}));function g(e){return new Promise(t=>{h.getState().open({...e,resolve:e=>t(e===!0)})})}function _(e){return new Promise(t=>{h.getState().open({...e,resolve:e=>t(e===null?`dismiss`:e?`confirm`:`cancel`)})})}function v(){let{t:e}=n(),t=h(e=>e.request),r=h(e=>e.settle);return(0,p.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Enter`&&(e.preventDefault(),h.getState().settle(t.defaultAction!==`cancel`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,m.jsx)(u,{open:t!==null,onOpenChange:e=>{e||r(null)},children:(0,m.jsxs)(s,{className:`max-w-md`,children:[(0,m.jsxs)(a,{children:[(0,m.jsx)(c,{children:t?.title}),t?.message&&(0,m.jsx)(l,{children:t.message})]}),(0,m.jsxs)(o,{className:`gap-2`,children:[(0,m.jsx)(d,{variant:`outline`,size:`sm`,autoFocus:t?.defaultAction===`cancel`,onClick:()=>r(!1),children:t?.cancelLabel??e(`common:action.cancel`)}),(0,m.jsx)(d,{variant:t?.danger?`destructive`:`default`,size:`sm`,autoFocus:t?.defaultAction!==`cancel`,onClick:()=>r(!0),children:t?.confirmLabel??e(`common:action.confirm`)})]})]})})}var y=t()((e,t)=>({request:null,open:n=>{t().request?.resolve(null),e({request:n})},settle:n=>{t().request?.resolve(n),e({request:null})}}));function b(e){return new Promise(t=>{y.getState().open({...e,resolve:t})})}function x(){let{t:e}=n(),t=y(e=>e.request),r=y(e=>e.settle),[i,h]=(0,p.useState)(``);(0,p.useEffect)(()=>{h(t?.defaultValue??``)},[t]);let g=()=>{let e=i.trim();r(e.length>0?e:null)};return(0,m.jsx)(u,{open:t!==null,onOpenChange:e=>{e||r(null)},children:(0,m.jsxs)(s,{className:`max-w-md`,children:[(0,m.jsxs)(a,{children:[(0,m.jsx)(c,{children:t?.title}),t?.message&&(0,m.jsx)(l,{children:t.message})]}),(0,m.jsx)(f,{autoFocus:!0,value:i,placeholder:t?.placeholder,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())}}),(0,m.jsxs)(o,{className:`gap-2`,children:[(0,m.jsx)(d,{variant:`outline`,size:`sm`,onClick:()=>r(null),children:t?.cancelLabel??e(`common:action.cancel`)}),(0,m.jsx)(d,{size:`sm`,disabled:i.trim().length===0,onClick:g,children:t?.confirmLabel??e(`common:action.ok`)})]})]})})}export{b as a,_ as i,x as n,g as r,v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Bi as n,Pa as r,Vi as i,lt as a,pn as o,za as s}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{P as c}from"./stores-ChEnUmic.js";import{a as l,n as u,o as d,r as f,t as p}from"./dialog-ftgTihmF.js";import{D as m,o as h}from"./index-CtpViiZy.js";var g=e(s(),1),_=a();function v(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:e<36e5?`${(e/6e4).toFixed(1)}m`:`${(e/36e5).toFixed(1)}h`}function y(e){if(!e)return`—`;let t=new Date(e),n=Date.now(),r=t.getTime()-n,i=Math.abs(r);if(i<6e4)return r>=0?`<1m`:`<1m ago`;if(i<36e5){let e=Math.round(i/6e4);return r>=0?`${e}m`:`${e}m ago`}if(i<864e5){let e=Math.round(i/36e5);return r>=0?`${e}h`:`${e}h ago`}return t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function b({enabled:e,overdue:a}){let{t:o}=r();return e?a?(0,_.jsxs)(h,{variant:`destructive`,className:`gap-1`,children:[(0,_.jsx)(t,{className:`h-3 w-3`}),o(`activity:cronJobs.statusOverdue`)]}):(0,_.jsxs)(h,{variant:`outline`,className:`gap-1 border-success/30 bg-success/10 text-success`,children:[(0,_.jsx)(n,{className:`h-3 w-3`}),o(`activity:cronJobs.statusActive`)]}):(0,_.jsxs)(h,{variant:`secondary`,className:`gap-1`,children:[(0,_.jsx)(i,{className:`h-3 w-3`}),o(`activity:cronJobs.statusDisabled`)]})}function x({open:e,onClose:n}){let{t:i}=r(),a=c(e=>e.snapshot),s=c(e=>e.lastFiredAt);c(e=>e.revision);let h=a?.jobs??[],x=a?.count??0,S=a?.maxConcurrent??0,C=h.filter(e=>e.overdue).length,w=h.filter(e=>e.enabled).length,T=h.reduce((e,t)=>e+t.runCount,0);return(0,_.jsx)(p,{open:e,onOpenChange:(0,g.useCallback)(e=>{e||n()},[n]),children:(0,_.jsxs)(u,{className:`max-w-3xl max-h-[80vh] flex flex-col`,children:[(0,_.jsxs)(l,{children:[(0,_.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,_.jsx)(o,{className:`h-5 w-5`}),i(`activity:cronJobs.heading`)]}),(0,_.jsx)(f,{children:i(`activity:cronJobs.subtitle`)})]}),x>0&&(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm text-muted-foreground border-b border-border/70 pb-3`,children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:i(`activity:cronJobs.jobCount`,{count:x})}),(0,_.jsx)(`span`,{className:`text-success`,children:i(`activity:cronJobs.enabledCount`,{count:w})}),C>0&&(0,_.jsx)(`span`,{className:`text-destructive`,children:i(`activity:cronJobs.overdueCount`,{count:C})}),(0,_.jsx)(`span`,{children:i(`activity:cronJobs.totalRuns`,{count:T})}),(0,_.jsx)(`span`,{className:`text-muted-foreground/60`,children:i(`activity:cronJobs.maxConcurrent`,{count:S})})]}),x===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-12 text-muted-foreground`,children:[(0,_.jsx)(t,{className:`h-8 w-8 opacity-40`}),(0,_.jsx)(`p`,{className:`text-sm`,children:i(`activity:cronJobs.emptyTitle`)}),(0,_.jsxs)(`p`,{className:`text-xs`,children:[i(`activity:cronJobs.emptyUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5`,children:`cron_schedule`}),` `,i(`activity:cronJobs.emptyToAdd`)]})]}),x>0&&(0,_.jsx)(m,{className:`flex-1 -mx-6 px-6`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-border/50 text-left text-xs text-muted-foreground`,children:[(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:i(`activity:cronJobs.thStatus`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:i(`activity:cronJobs.thName`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:i(`activity:cronJobs.thInterval`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium text-right`,children:i(`activity:cronJobs.thRuns`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:i(`activity:cronJobs.thNextRun`)}),(0,_.jsx)(`th`,{className:`pb-2 pr-3 font-medium`,children:i(`activity:cronJobs.thLastRun`)}),(0,_.jsx)(`th`,{className:`pb-2 font-medium`,children:i(`activity:cronJobs.thAction`)})]})}),(0,_.jsx)(`tbody`,{children:h.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-border/30 last:border-0`,children:[(0,_.jsx)(`td`,{className:`py-2.5 pr-3`,children:(0,_.jsx)(b,{enabled:e.enabled,overdue:e.overdue})}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs font-medium max-w-[160px] truncate`,title:e.name,children:e.name}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:v(e.intervalMs)}),(0,_.jsxs)(`td`,{className:`py-2.5 pr-3 text-right font-mono text-xs tabular-nums`,children:[e.runCount,s[e.name]&&(0,_.jsx)(`span`,{className:`ml-1 text-success`,title:i(`activity:cronJobs.lastFiredAtTitle`,{time:s[e.name]}),children:`●`})]}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.nextRun)}),(0,_.jsx)(`td`,{className:`py-2.5 pr-3 font-mono text-xs tabular-nums`,children:y(e.lastRun)}),(0,_.jsx)(`td`,{className:`py-2.5 font-mono text-xs max-w-[200px] truncate text-muted-foreground`,title:e.action,children:e.action})]},e.name))})]})}),x>0&&(0,_.jsxs)(`p`,{className:`text-xs text-muted-foreground pt-3 border-t border-border/70`,children:[i(`activity:cronJobs.footerUse`),` `,(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px]`,children:`cron_schedule`}),` `,i(`activity:cronJobs.footerToAdd`),(0,_.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-[11px] ml-1`,children:`cron_cancel`}),` `,i(`activity:cronJobs.footerToRemove`)]})]})})}export{x as CronJobsPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Pa as t,lt as n,za as r}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";var i=e(r(),1),a=n(),o={0:`P0 Dead Package`,1:`P1 Dead File`,2:`P2 Dead Symbol`},s={0:`hsl(var(--destructive))`,1:`hsl(var(--warning))`,2:`hsl(var(--info))`};async function c(e){let t=await e.text();try{return JSON.parse(t)}catch{let e=t.length>300?`${t.slice(0,300)}…`:t;throw console.warn(JSON.stringify({level:`warn`,event:`deadcode_parse_error`,preview:e,timestamp:new Date().toISOString()})),Error(`The server returned a non-JSON response (possibly an HTML error page). Check that the backend is running and the /api/deadcode/* routes are wired.`)}}function l(){let{t:e}=t(),[n,r]=(0,i.useState)(`idle`),[l,u]=(0,i.useState)(`idle`),[m,h]=(0,i.useState)(null),[g,_]=(0,i.useState)(null),[v,y]=(0,i.useState)(null),b=(0,i.useCallback)(async()=>{r(`scanning`),y(null),h(null),_(null),u(`idle`);try{let e=await fetch(`/api/deadcode/scan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});if(!e.ok){let t=await c(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await c(e);h(t),r(`done`)}catch(e){y(e instanceof Error?e.message:String(e)),r(`error`)}},[]),x=(0,i.useCallback)(async()=>{if(m){u(`generating`),y(null);try{let e=await fetch(`/api/deadcode/action-plan`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(m)});if(!e.ok){let t=await c(e);throw Error(t.detail??t.error??`HTTP ${e.status}`)}let t=await c(e);_(t),u(`ready`)}catch(e){y(e instanceof Error?e.message:String(e)),u(`idle`)}}},[m]),S=(0,i.useCallback)(()=>{if(!g)return;u(`executing`);let e=[`# Dead-Code Cleanup Plan`,``,g.summary,``,`## Files to address (in priority order)`,...g.files.map((e,t)=>`${t+1}. [${o[e.priority]}] ${e.file} — ${e.symbolCount} symbol(s) to remove`+(e.symbols.length>0?`\n Symbols: ${e.symbols.slice(0,5).join(`, `)}${e.symbols.length>5?` and ${e.symbols.length-5} more`:``}`:``))].join(`
|
|
2
|
+
`),t=window.__WS;t&&t.readyState===WebSocket.OPEN?t.send(JSON.stringify({type:`user.message`,payload:{text:e,action:`send`}})):(navigator.clipboard.writeText(e),y(`Agent not connected. Plan copied to clipboard — paste it into the chat.`)),u(`idle`)},[g]);return(0,a.jsxs)(`div`,{style:{padding:`16px`,fontFamily:`var(--font-sans, system-ui, sans-serif)`,color:`hsl(var(--foreground))`,background:`hsl(var(--background))`},children:[(0,a.jsx)(`h2`,{style:{margin:`0 0 16px`,fontSize:`18px`,fontWeight:600,color:`hsl(var(--foreground))`},children:e(`activity:deadCode.deadCodeScan`)}),(0,a.jsx)(`button`,{type:`button`,onClick:b,disabled:n===`scanning`,style:{padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:n===`scanning`?`hsl(var(--muted))`:`hsl(var(--primary))`,color:n===`scanning`?`hsl(var(--muted-foreground))`:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:n===`scanning`?`not-allowed`:`pointer`},children:n===`scanning`?`Scanning…`:`Scan for Dead Code`}),v&&(0,a.jsxs)(`div`,{style:{marginTop:`12px`,padding:`8px 12px`,background:`hsl(var(--destructive) / 0.1)`,color:`hsl(var(--destructive))`,border:`1px solid hsl(var(--destructive) / 0.3)`,borderRadius:`0`,fontSize:`13px`},children:[v,(0,a.jsx)(`button`,{type:`button`,onClick:()=>y(null),style:{marginLeft:`12px`,background:`none`,border:`none`,cursor:`pointer`,fontWeight:600,color:`hsl(var(--destructive))`},children:`✕`})]}),m&&(0,a.jsxs)(`div`,{style:{marginTop:`16px`},children:[(0,a.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,marginBottom:`12px`},children:[(0,a.jsx)(d,{label:e(`activity:deadCode.totalSymbols`),value:m.stats.totalSymbols,token:`info`}),(0,a.jsx)(d,{label:e(`activity:deadCode.alive`),value:m.stats.alive,token:`success`}),(0,a.jsx)(d,{label:e(`activity:deadCode.dead`),value:m.stats.dead,token:`destructive`})]}),m.deadPackages.length>0&&(0,a.jsx)(f,{title:`Dead Packages (${m.deadPackages.length})`,token:`destructive`,children:m.deadPackages.map(e=>(0,a.jsx)(p,{columns:[e.package,e.path,`${e.fileCount} file(s)`]},e.package))}),m.deadFiles.length>0&&(0,a.jsx)(f,{title:`Dead Files (${m.deadFiles.length})`,token:`warning`,children:m.deadFiles.map(e=>(0,a.jsx)(p,{columns:[e.file,`${e.symbolCount} symbol(s)`,e.lang]},e.file))}),m.deadSymbols.length>0&&(0,a.jsxs)(f,{title:`Dead Symbols (${m.deadSymbols.length})`,token:`info`,children:[m.deadSymbols.slice(0,50).map(e=>(0,a.jsx)(p,{columns:[e.name,e.kind,e.file.split(`/`).pop()??e.file,`line ${e.line}`]},`${e.file}:${e.line}:${e.name}`)),m.deadSymbols.length>50&&(0,a.jsxs)(`div`,{style:{padding:`6px 8px`,color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[`… and `,m.deadSymbols.length-50,` more`]})]}),n===`done`&&(0,a.jsx)(`button`,{type:`button`,onClick:x,disabled:l===`generating`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:l===`generating`?`hsl(var(--muted))`:`hsl(var(--accent))`,color:l===`generating`?`hsl(var(--muted-foreground))`:`hsl(var(--accent-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:l===`generating`?`not-allowed`:`pointer`},children:l===`generating`?`Generating…`:`Generate Action Plan`})]}),g&&(0,a.jsxs)(`div`,{style:{marginTop:`16px`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,padding:`12px`,background:`hsl(var(--card))`},children:[(0,a.jsx)(`h3`,{style:{margin:`0 0 8px`,fontSize:`15px`,fontWeight:600,color:`hsl(var(--card-foreground))`},children:e(`activity:deadCode.actionPlan`)}),(0,a.jsx)(`p`,{style:{fontSize:`13px`,color:`hsl(var(--muted-foreground))`,margin:`0 0 12px`},children:g.summary}),g.files.map((e,t)=>(0,a.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`8px`,padding:`6px 0`,borderBottom:t<g.files.length-1?`1px solid hsl(var(--border))`:`none`,fontSize:`13px`},children:[(0,a.jsx)(`span`,{style:{background:s[e.priority]??`hsl(var(--muted-foreground))`,color:`hsl(var(--primary-foreground))`,borderRadius:`0`,padding:`2px 6px`,fontSize:`11px`,fontWeight:600,whiteSpace:`nowrap`,flexShrink:0},children:o[e.priority]??`P${e.priority}`}),(0,a.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,a.jsx)(`div`,{style:{fontWeight:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,color:`hsl(var(--foreground))`},children:e.file}),(0,a.jsxs)(`div`,{style:{color:`hsl(var(--muted-foreground))`,fontSize:`12px`},children:[e.symbolCount,` symbol(s)`,e.symbols.length>0&&` · ${e.symbols.slice(0,2).join(`, `)}${e.symbols.length>2?`…`:``}`]})]})]},e.file)),(0,a.jsx)(`button`,{type:`button`,onClick:S,disabled:l===`executing`,style:{marginTop:`12px`,padding:`8px 16px`,fontSize:`14px`,fontWeight:500,background:l===`executing`?`hsl(var(--muted))`:`hsl(var(--success))`,color:`hsl(var(--primary-foreground))`,border:`1px solid hsl(var(--border))`,borderRadius:`0`,cursor:l===`executing`?`not-allowed`:`pointer`},children:l===`executing`?`Sending…`:`Execute Plan via Agent`})]})]})}var u={success:`hsl(var(--success))`,warning:`hsl(var(--warning))`,info:`hsl(var(--info))`,destructive:`hsl(var(--destructive))`,primary:`hsl(var(--primary))`};function d({label:e,value:t,token:n}){let r=u[n];return(0,a.jsxs)(`div`,{style:{flex:1,padding:`10px`,borderRadius:`0`,border:`1px solid hsl(var(--border))`,background:`hsl(var(--card))`,textAlign:`center`},children:[(0,a.jsx)(`div`,{style:{fontSize:`24px`,fontWeight:700,color:r},children:t}),(0,a.jsx)(`div`,{style:{fontSize:`12px`,color:`hsl(var(--muted-foreground))`,marginTop:`2px`},children:e})]})}function f({title:e,token:t,children:n}){let r=u[t];return(0,a.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,a.jsx)(`h3`,{style:{margin:`0 0 6px`,fontSize:`14px`,fontWeight:600,color:r,borderLeft:`3px solid ${r}`,paddingLeft:`8px`},children:e}),(0,a.jsx)(`div`,{style:{border:`1px solid hsl(var(--border))`,borderRadius:`0`,overflow:`hidden`,fontSize:`13px`},children:n})]})}function p({columns:e}){return(0,a.jsx)(`div`,{style:{display:`flex`,gap:`8px`,padding:`5px 8px`,borderBottom:`1px solid hsl(var(--border))`,fontSize:`13px`,fontFamily:`var(--font-mono, monospace)`,background:`hsl(var(--card))`,color:`hsl(var(--card-foreground))`},children:e.map((e,t)=>(0,a.jsx)(`span`,{style:{flex:t===0?2:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e},t))})}export{l as DeadCodeScanPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ki as n,La as r,Lr as i,Oa as a,Pa as o,kt as s,li as c,lt as l,ni as u,rn as d,ta as f,vn as p,za as m}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{c as h}from"./index-CtpViiZy.js";var g=e(m(),1),_=l();function v({title:e,value:t,subtitle:n,icon:r,color:i=`text-primary`,trend:a}){let{t:c}=o();return(0,_.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground font-medium`,children:e}),(0,_.jsx)(`p`,{className:`mt-1 truncate text-xl font-semibold tabular-nums sm:text-2xl ${i}`,children:t}),n&&(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n})]}),(0,_.jsx)(`div`,{className:`shrink-0 rounded-lg bg-muted/70 p-2 ${i}`,children:(0,_.jsx)(r,{className:`w-5 h-5`})})]}),a&&(0,_.jsxs)(`div`,{className:`mt-2 flex items-center gap-1`,children:[a===`up`&&(0,_.jsx)(s,{className:`w-3 h-3 text-success`}),a===`down`&&(0,_.jsx)(s,{className:`w-3 h-3 rotate-180 text-destructive`}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(a===`up`?`activity:debug.trendUp`:a===`down`?`activity:debug.trendDown`:`activity:debug.trendStable`)})]})]})}function y(){let{t:e}=o(),[l,m]=(0,g.useState)({fileWatcher:null,system:null,lastUpdated:null,error:null}),[y,C]=(0,g.useState)(!0),[w,T]=(0,g.useState)(2e3),E=(0,g.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch(`/debug/watcher-metrics`),fetch(`/debug/system`,{cache:`no-store`})]),n=null,r=e.headers.get(`content-type`)??``;if(e.ok&&r.includes(`application/json`)&&(n=await e.json()),!t.ok)throw Error(`System metrics request failed (${t.status})`);let i=await t.json();m({fileWatcher:n,system:i,lastUpdated:new Date,error:null})}catch(e){m(t=>({...t,error:e instanceof Error?e.message:r.t(`activity:debug.fetchFailed`)}))}finally{C(!1)}},[]);return(0,g.useEffect)(()=>{E();let e=setInterval(E,w);return()=>clearInterval(e)},[E,w]),(0,_.jsx)(`div`,{ref:h(`debug`),className:`h-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,_.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-5`,children:[(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold sm:text-xl`,children:[(0,_.jsx)(f,{className:`h-5 w-5 text-primary`}),e(`activity:debug.heading`)]}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`activity:debug.subtitle`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,_.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:[(0,_.jsx)(p,{className:`w-4 h-4 text-muted-foreground`}),(0,_.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e(`activity:debug.refreshLabel`)}),(0,_.jsxs)(`select`,{value:w,onChange:e=>T(Number(e.target.value)),className:`h-9 rounded-md border border-border/70 bg-background/70 px-2 text-sm`,children:[(0,_.jsx)(`option`,{value:1e3,children:`1s`}),(0,_.jsx)(`option`,{value:2e3,children:`2s`}),(0,_.jsx)(`option`,{value:5e3,children:`5s`}),(0,_.jsx)(`option`,{value:1e4,children:`10s`})]})]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>{C(!0),E()},disabled:y,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 disabled:opacity-50`,children:[(0,_.jsx)(p,{className:`w-4 h-4 ${y?`animate-spin`:``}`}),e(`common:action.refresh`)]})]})]})}),l.lastUpdated&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-card/55 px-3 py-2 text-sm text-muted-foreground`,children:[(0,_.jsx)(t,{className:`w-4 h-4`}),e(`activity:debug.lastUpdated`,{time:l.lastUpdated.toLocaleTimeString()})]}),l.error&&(0,_.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-destructive/25 bg-destructive/10 p-4 text-destructive`,children:[(0,_.jsx)(n,{className:`w-5 h-5 flex-shrink-0`}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`p`,{className:`font-medium`,children:e(`activity:debug.fetchFailed`)}),(0,_.jsx)(`p`,{className:`text-sm opacity-80`,children:l.error})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(c,{className:`h-4 w-4 text-primary`}),e(`activity:debug.fileWatcher`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.watcherStatus`),value:l.fileWatcher?.watcherActive?e(`activity:debug.running`):e(`activity:debug.stopped`),icon:d,color:l.fileWatcher?.watcherActive?`text-success`:`text-destructive`}),(0,_.jsx)(v,{title:e(`activity:debug.activeProjects`),value:l.fileWatcher?.activeProjects??0,subtitle:e(`activity:debug.projectsWatched`),icon:u,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.fileChanges`),value:l.fileWatcher?.fileChangesDetected??0,subtitle:e(`activity:debug.totalDetected`),icon:a,color:`text-primary`,trend:`neutral`}),(0,_.jsx)(v,{title:e(`activity:debug.filesProcessed`),value:l.fileWatcher?.filesProcessed??0,subtitle:e(`activity:debug.afterHash`),icon:i,color:`text-success`})]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mt-4`,children:[(0,_.jsx)(v,{title:e(`activity:debug.broadcastsSent`),value:l.fileWatcher?.broadcastsSent??0,subtitle:e(`activity:debug.toClients`),icon:s,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debug.debounceResets`),value:l.fileWatcher?.debounceResets??0,subtitle:e(`activity:debug.rapidWrites`),icon:p,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.avgDebounce`),value:`${(l.fileWatcher?.averageDebounceDelayMs??0).toFixed(1)}ms`,subtitle:e(`activity:debug.actualDelay`),icon:t,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debug.totalDelay`),value:`${(l.fileWatcher?.totalDebounceDelayMs??0).toFixed(0)}ms`,subtitle:e(`activity:debug.sumDelays`),icon:f,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(i,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.webuiServerProcess`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.processRamRss`),value:b(l.system?.memoryUsage?.rss??0),subtitle:l.system?`PID ${l.system.pid}`:void 0,icon:d,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapUsed`),value:b(l.system?.memoryUsage?.heapUsed??0),subtitle:e(`activity:debug.jsHeap`),icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debug.heapTotal`),value:b(l.system?.memoryUsage?.heapTotal??0),subtitle:e(`activity:debug.totalHeap`),icon:f,color:`text-success`}),(0,_.jsx)(v,{title:e(`activity:debugDash.v8HeapLimit`),value:b(l.system?.heapLimit??0),subtitle:e(`activity:debugDash.oldSpaceCeiling`),icon:i,color:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.serverUptime`),value:S(l.system?.uptime??0),subtitle:e(`activity:debugDash.sinceProcessStart`),icon:t,color:`text-primary`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.liveWrongstackProcesses`)]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[980px] text-left text-xs`,children:[(0,_.jsx)(`thead`,{className:`border-b border-border/70 bg-muted/35 text-muted-foreground`,children:(0,_.jsxs)(`tr`,{children:[(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.surface`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.memory`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.growthSignal`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.workload`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.hqOfflineQueue`)}),(0,_.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e(`activity:debugDash.resourcesHotspot`)})]})}),(0,_.jsxs)(`tbody`,{children:[(l.system?.processes??[]).map(e=>{let t=[e.workload.messages===void 0?void 0:`${e.workload.messages} msgs`,e.workload.messageEstimatedTokens===void 0?void 0:`${e.workload.messageEstimatedTokens.toLocaleString()} ctx tokens`,e.workload.historyEntries===void 0?void 0:`${e.workload.historyMountedEntries??0}/${e.workload.historyEntries} history mounted`,e.workload.appRenders===void 0?void 0:`${e.workload.appRenders} renders`,e.workload.metricsDroppedObservations?`${e.workload.metricsDroppedObservations} metric drops`:void 0,e.workload.kanbanSyncActive?`kanban sync active`:void 0,e.workload.kanbanSyncPendingBoards?`${e.workload.kanbanSyncPendingBoards} kanban pending`:void 0,e.workload.kanbanSyncFullRescanPending?`kanban full rescan pending`:void 0,e.workload.kanbanSyncRemoteApplyQueued?`${e.workload.kanbanSyncPendingRemoteBoards??0} remote boards queued`:void 0,e.workload.kanbanSyncCoalescedRefreshes?`${e.workload.kanbanSyncCoalescedRefreshes} kanban coalesced`:void 0,e.workload.kanbanSupervisorSnapshots?`${e.workload.kanbanSupervisorSnapshots} supervised boards`:void 0,e.workload.kanbanSupervisorScheduledBoards?`${e.workload.kanbanSupervisorScheduledBoards} supervisor schedules`:void 0].filter(Boolean).join(` · `);return(0,_.jsxs)(`tr`,{className:`border-b border-border/50 align-top last:border-b-0`,children:[(0,_.jsxs)(`td`,{className:`px-3 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-foreground`,children:e.surface}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`PID `,e.pid]}),(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsxs)(`div`,{children:[`RSS `,b(e.memory.rss)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`heap `,b(e.memory.heapUsed),e.memory.retainedHeapUsed===void 0?``:` · retained ${b(e.memory.retainedHeapUsed)}`]}),e.memory.nativeResidual===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`native `,b(e.memory.nativeResidual)]}),e.memory.external===void 0?null:(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`external `,b(e.memory.external),e.memory.arrayBuffers===void 0?``:` · buffers ${b(e.memory.arrayBuffers)}`]})]}),(0,_.jsxs)(`td`,{className:`px-3 py-3 tabular-nums`,children:[(0,_.jsx)(`div`,{className:e.signal===`stable`?`text-success`:e.signal?`text-warning`:`text-muted-foreground`,children:e.signal??`sampling`}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[`heap `,x(e.heapGrowthBytesPerHour)]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`RSS `,x(e.rssGrowthBytesPerHour)]})]}),(0,_.jsx)(`td`,{className:`px-3 py-3 text-muted-foreground`,children:t||`—`}),(0,_.jsx)(`td`,{className:`px-3 py-3 tabular-nums`,children:e.hqQueue?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{children:[e.hqQueue.entries,` frames ·`,` `,b(e.hqQueue.bytes),` /`,` `,b(e.hqQueue.maxBytes)]}),(0,_.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.hqQueue.coalescedFrames,` coalesced ·`,` `,e.hqQueue.droppedFrames,` dropped`]}),e.hqSnapshot?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`snapshot`,` `,e.hqSnapshot.inFlight?`in-flight`:e.hqSnapshot.pending?`pending`:e.hqSnapshot.timerScheduled?`scheduled`:`idle`]}),(0,_.jsxs)(`div`,{className:`text-muted-foreground`,children:[`events`,` `,e.hqSnapshot.eventInFlight?`in-flight`:`idle`,` ·`,` `,e.hqSnapshot.pendingEvents,` pending ·`,` `,e.hqSnapshot.coalescedEvents,` coalesced ·`,` `,e.hqSnapshot.droppedEvents,` dropped`]})]}):null]}):(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,_.jsxs)(`td`,{className:`max-w-[360px] px-3 py-3 text-muted-foreground`,children:[(0,_.jsxs)(`div`,{children:[e.resources.active??0,` active`,e.resources.types?` · ${e.resources.types}`:``]}),e.profileTopStack?(0,_.jsxs)(`div`,{className:`mt-1 truncate`,title:e.profileTopStack,children:[e.profileTopStackBytes===void 0?``:`${b(e.profileTopStackBytes)} · `,e.profileTopStack]}):null]})]},e.pid)}),(l.system?.processes?.length??0)===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{className:`px-3 py-5 text-muted-foreground`,colSpan:6,children:e(`activity:debugDash.waitingForHeapFlightRecorderSamples`)})}):null]})]})})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(d,{className:`h-4 w-4 text-primary`}),e(`activity:debugDash.codebaseIndexServer`)]}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4`,children:[(0,_.jsx)(v,{title:e(`activity:debugDash.connection`),value:l.system?.codebaseIndexServer?.health?.status??l.system?.codebaseIndexServer?.status??`unknown`,subtitle:l.system?.codebaseIndexServer?.pid?`PID ${l.system.codebaseIndexServer.pid} · RTT ${l.system.codebaseIndexServer.health?.latencyMs??`—`}ms`:`No connected project server`,icon:a,color:l.system?.codebaseIndexServer?.health?.status===`healthy`?`text-success`:l.system?.codebaseIndexServer?.status===`unresponsive`||l.system?.codebaseIndexServer?.status===`error`?`text-destructive`:`text-warning`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexRamRss`),value:b(l.system?.codebaseIndexServer?.health?.server?.memory.rss??0),subtitle:`Heap ${b(l.system?.codebaseIndexServer?.health?.server?.memory.heapUsed??0)} / ${b(l.system?.codebaseIndexServer?.health?.server?.memory.heapTotal??0)}`,icon:f,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWorkload`),value:`${l.system?.codebaseIndexServer?.health?.server?.activeRequests??0} requests`,subtitle:`${l.system?.codebaseIndexServer?.health?.server?.activeWrites??0} writes · ${l.system?.codebaseIndexServer?.health?.server?.queuedWrites??0} queued`,icon:i,color:`text-primary`}),(0,_.jsx)(v,{title:e(`activity:debugDash.indexWatcher`),value:l.system?.codebaseIndexServer?.health?.server?.watchingExternal?`Active`:`Off`,subtitle:`${l.system?.codebaseIndexServer?.health?.server?.watchingClients??0} owners · ${l.system?.codebaseIndexServer?.health?.server?.pendingExternalFiles??0} pending`,icon:c,color:l.system?.codebaseIndexServer?.health?.server?.watchingExternal?`text-success`:`text-muted-foreground`})]})]}),(0,_.jsxs)(`section`,{children:[(0,_.jsxs)(`h2`,{className:`mb-3 flex items-center gap-2 text-sm font-semibold text-muted-foreground`,children:[(0,_.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`activity:debug.rawData`)]}),(0,_.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,_.jsx)(`pre`,{className:`overflow-x-auto text-xs font-mono text-muted-foreground`,children:JSON.stringify({fileWatcher:l.fileWatcher,serverPid:l.system?.pid,serverMemory:l.system?.memoryUsage,serverHeapLimit:l.system?.heapLimit,serverUptime:l.system?.uptime,processes:l.system?.processes,codebaseIndexServer:l.system?.codebaseIndexServer},null,2)})})]})]})})}function b(e){if(e===0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/t**r).toFixed(1)} ${n[r]}`}function x(e){return e===void 0?`—`:`${e>0?`+`:e<0?`−`:``}${b(Math.abs(e))}/h`}function S(e){return e<60?`${e.toFixed(0)}s`:e<3600?`${(e/60).toFixed(1)}m`:`${(e/3600).toFixed(1)}h`}export{y as DebugDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,In as n,La as r,Pa as i,Zt as a,an as o,dt as s,gi as c,lt as l,za as u}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as d}from"./useWebSocket-_gk4MRJz.js";import{t as f}from"./utils-B-9lSDIn.js";import{o as p}from"./view-navigation-DIDEcp4V.js";import{c as m}from"./index-CtpViiZy.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{t:n}=i(),r=e.bg??`#fff`,a=e.surface??r,o=e.fg??`#111`,s=e.muted??o,c=e.primary??`#3b82f6`,l=e.accent??c,u=e.border??s,d=e[`radius-md`]??e.radius??`0.5rem`,f=e[`font-sans`]??e.fontSans??`system-ui, sans-serif`,p=e[`font-display`]??e.fontDisplay??f,m=e[`shadow-2`]??(e.shadow&&e.shadow!==`none`?e.shadow:void 0);return(0,S.jsxs)(`div`,{style:{background:r,color:o,fontFamily:f},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:s},children:t}),(0,S.jsxs)(`div`,{style:{background:a,border:`1px solid ${u}`,borderRadius:d,boxShadow:m},className:`flex min-w-0 flex-col gap-2 p-3`,children:[(0,S.jsx)(`div`,{style:{fontFamily:p},className:`text-base font-bold leading-tight`,children:n(`activity:designStudio.aaHeading`)}),(0,S.jsx)(`div`,{className:`text-[11px] leading-snug`,style:{color:s},children:n(`activity:designStudio.theQuickBrownFoxJumpsOver`)}),(0,S.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-1.5`,children:[(0,S.jsx)(`span`,{style:{background:c,color:r,borderRadius:d},className:`shrink-0 px-2.5 py-1 text-[10px] font-semibold`,children:n(`activity:designStudio.primary`)}),(0,S.jsx)(`span`,{style:{border:`1px solid ${u}`,color:o,borderRadius:d},className:`shrink-0 px-2 py-1 text-[10px]`,children:n(`activity:designStudio.ghost`)}),(0,S.jsx)(`span`,{style:{background:l,color:r,borderRadius:`999px`},className:`ml-auto shrink-0 px-2 py-0.5 text-[9px] font-semibold`,children:n(`activity:designStudio.badge`)})]}),(0,S.jsx)(`div`,{style:{border:`1px solid ${u}`,borderRadius:d,color:s},className:`text-[10px] px-2 py-1.5 mt-1`,children:n(`activity:designStudio.inputField`)})]})]})}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}=i(),[n,r]=(0,h.useState)(``),a=({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:t(`activity:designStudio.tune`)}),(0,S.jsx)(a,{label:t(`activity:designStudio.radius`),knob:`radius`,values:[`none`,`sm`,`md`,`lg`,`xl`,`full`]}),(0,S.jsx)(a,{label:t(`activity:designStudio.density`),knob:`density`,values:[`compact`,`cozy`,`comfortable`]}),(0,S.jsx)(a,{label:t(`activity:designStudio.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:t(`activity:designStudio.font`)}),(0,S.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),onKeyDown:t=>{t.key===`Enter`&&n.trim()&&e({font:n.trim()})},placeholder:t(`activity:designStudio.spaceGrotesk`),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:()=>n.trim()&&e({font:n.trim()}),className:`rounded border border-border/60 px-1.5 py-0.5 text-[10px] hover:bg-muted`,children:t(`activity:designStudio.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)},i=e=>{let t=e.payload;t?.ok&&t.overrides?(x(t.overrides),N(`Tuned`)):t?.error&&N(`Tune failed: ${t.error}`)},a=e=>{let t=e.payload;t?.ok&&t.kit&&(y(t.kit),x(t.overrides??{}),N(`Swapped to ${t.kit}`))},o=e=>{let t=e.payload;N(t?.ok?r.t(`activity:design.wrote`,{path:t.path}):r.t(`activity:design.materializeFailed`,{error:t?.error??`error`}))},s=e=>{let t=e.payload;if(!t?.ok){N(r.t(`activity:design.verifyError`,{error:t?.error??`error`}));return}let n=Math.round((t.score??1)*100);N(t.violationCount?r.t(`activity:design.verifyOffPalette`,{pct:n,count:t.violationCount,files:t.filesScanned}):r.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`,i),l.on(`design.swap`,a),l.on(`design.materialize`,o),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`,i),l.off(`design.swap`,a),l.off(`design.materialize`,o),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(r.t(`activity:design.writing`)),l?.send({type:`design.materialize`,payload:{stack:w}})},[l,w]),R=(0,h.useCallback)(()=>{N(r.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)(n,{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)(o,{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)(n,{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 n=v===e.id,r=n?b:{};return(0,S.jsxs)(`div`,{className:f(`flex min-w-0 flex-col overflow-hidden rounded-xl border bg-card/75 shadow-sm`,n?`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,r,`light`),label:u(`activity:designStudio.light`)}),(0,S.jsx)(E,{t:T(e.dark,r,`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}),n&&(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)(t,{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`,n?`bg-primary/10 text-primary`:`bg-primary text-primary-foreground hover:opacity-90`),children:u(n?`activity:design.reapply`:`activity:design.use`)}),n&&(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)(c,{className:`w-3 h-3`}),` `,u(`activity:design.materialize`)]}),n&&(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)(a,{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})]}),n&&(0,S.jsx)(D,{kit:e,overrides:r,onSet:F}),n&&(0,S.jsx)(O,{onTune:I})]})]},e.id)})})})]})}export{k as DesignGalleryView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-DbxFVDwi.js";import{Ai as n,Bt as r,Cn as i,Ct as a,Et as o,Fi as s,Ii as c,La as l,Pa as u,Ti as d,Wi as f,dn as p,dt as m,gr as h,hn as g,ir as _,kn as v,lt as y,mn as b,ut as x,wn as S,za as C}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as ee}from"./useWebSocket-_gk4MRJz.js";import{t as w}from"./utils-B-9lSDIn.js";import{_ as T,t as E,v as D}from"./stores-ChEnUmic.js";import{o as O}from"./view-navigation-DIDEcp4V.js";import{t as k}from"./button-Dcy288Mc.js";import{a as A}from"./ConfirmModal-ndS17YwF.js";import{h as j,m as te,p as ne}from"./index-CtpViiZy.js";var M=e(C(),1),N=y(),P={pending:{icon:(0,N.jsx)(s,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,N.jsx)(n,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,N.jsx)(v,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,N.jsx)(c,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,N.jsx)(b,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,N.jsx)(f,{className:`w-4 h-4`}),color:`text-success`}},F={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},I={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function L(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function R({task:e,onStatusChange:t,onRetry:r,agents:i,onAssign:o,compact:s,className:c}){let{t:l}=u(),d=P[e.status],[f,p]=(0,M.useState)(!1),m=e.status===`in_progress`;return(0,N.jsxs)(`div`,{className:w(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,N.jsx)(`span`,{className:w(`mt-0.5`,d.color),role:`img`,"aria-label":m?l(`common:status.inProgress`):void 0,children:d.icon}),(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,N.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,F[e.priority]),children:e.priority}),(0,N.jsx)(`span`,{className:w(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.type]),children:e.type})]}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,N.jsxs)(`div`,{className:w(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,N.jsx)(n,{className:`w-3 h-3 animate-spin`,"aria-label":l(`common:status.working`)}),(0,N.jsx)(`span`,{children:e.assignee})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,N.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,N.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,N.jsxs)(`span`,{children:[`• `,L(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,N.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!s&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:l(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:l(`activity:task.complete`)}),r&&(e.status===`failed`||e.status===`completed`)&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,N.jsx)(b,{className:`w-3 h-3`}),` `,l(`activity:task.retry`)]}),o&&i&&i.length>0&&(f?(0,N.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{o(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,N.jsx)(`option`,{value:``,children:l(`activity:task.unassigned`)}),i.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:l(`activity:task.assignTitle`),children:[(0,N.jsx)(a,{className:`w-3 h-3`}),` `,l(`activity:task.assign`)]}))]})]})}var z=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],B={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function re(){let{client:e}=ee(),{t}=u(),n=T(e=>e.phases),r=T(e=>e.multiBoard),[i,a]=(0,M.useState)(`phase`),[o,s]=(0,M.useState)(null),[c,l]=(0,M.useState)(null),[f,m]=(0,M.useState)(0),h=Math.min(f,Math.max(0,n.length-1)),g=r?n[h]:void 0,_=(0,M.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),v=(0,M.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,M.useCallback)(t=>e?.send?.(t),[e]),b=(0,M.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,M.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,M.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),C=(0,M.useCallback)(e=>{A({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),E=(0,M.useCallback)(e=>{o&&y({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),s(null),l(null)},[o,y]),D=(0,M.useCallback)(e=>{o&&y({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),s(null),l(null)},[o,y]),O={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function k(e){return{draggable:!0,onDragStart:t=>{s(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{s(null),l(null)}}}function j(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,c!==e&&l(e)},onDragLeave:()=>l(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":c===e||void 0}}return n.length===0?(0,N.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,N.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:_.length})}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`phase`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a(`status`),className:w(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(p,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r&&g?(0,N.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,N.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:n.map((e,t)=>(0,N.jsxs)(`button`,{type:`button`,onClick:()=>m(t),className:w(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,N.jsx)(`span`,{className:`truncate`,children:e.name}),(0,N.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,N.jsx)(U,{phase:g,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]}):(0,N.jsx)(H,{phases:n,allTasks:_,layout:i,dragId:o,hoverKey:c,callbacks:O,draggable:k,dropZone:j,dropToPhase:E,dropToStatus:D,onAddTask:C})]})}function V({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:a,dropToPhase:o,onAddTask:s,dragId:c,hoverKey:l}){let{t:d}=u();return(0,N.jsxs)(`div`,{...a(`phase:${e.id}`,()=>o(e.id)),className:w(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,N.jsx)(`span`,{className:w(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,B[e.status]),children:e.status})]}),(0,N.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),title:d(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,N.jsx)(i,{className:`h-4 w-4`})})]}),(0,N.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,N.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:d(`activity:board.dropHere`)}):t.map(e=>(0,N.jsx)(`div`,{...r(e.id),className:w(c===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,...n})},e.id))})]})}function H({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,N.jsx)(N.Fragment,{children:n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>(0,N.jsx)(V,{phase:e,phaseTasks:t.filter(t=>t.phaseId===e.id),callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id))}):(0,N.jsx)(W,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function U({phase:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=u();return n===`phase`?(0,N.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,N.jsx)(V,{phase:e,phaseTasks:f,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:d,dragId:r,hoverKey:i})}):(0,N.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),c=`cell:${e.id}:${t.key}`;return(0,N.jsx)(`div`,{...s(c,()=>l(t.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===c?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,N.jsx)(`div`,{...o(e.id),className:w(r===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...a})},e.id))},t.key)})]},e.id)]})})}function W({phases:e,allTasks:t,dragId:n,hoverKey:r,callbacks:i,draggable:a,dropZone:o,dropToStatus:s}){let{t:c}=u();return(0,N.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${z.length}, minmax(0, 1fr))`},children:[(0,N.jsx)(`div`,{}),z.map(e=>(0,N.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:c(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,N.jsxs)(G,{children:[(0,N.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,N.jsx)(`span`,{className:w(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,B[e.status]),children:e.status})]})}),z.map(c=>{let l=t.filter(t=>t.phaseId===e.id&&c.match.includes(t.status)),u=`cell:${e.id}:${c.key}`;return(0,N.jsx)(`div`,{...o(u,()=>s(c.key)),className:w(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,r===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,N.jsx)(`div`,{...a(e.id),className:w(n===e.id&&`opacity-50`),children:(0,N.jsx)(R,{task:e,compact:!0,...i})},e.id))},c.key)})]},e.id))]})}function G({children:e}){return(0,N.jsx)(N.Fragment,{children:e})}function K({onClose:e}){let{client:n}=ee(),{t:a}=u(),s=T(e=>e.phases),c=T(e=>e.overallPercent),d=T(e=>e.autonomous),f=T(e=>e.title),p=T(e=>e.goal),y=T(e=>e.status),b=T(e=>e.lastError),C=T(e=>e.graphs);(0,M.useEffect)(()=>{n?.send?.({type:`goal.list`}),n?.send?.({type:`goal.state`})},[n]);let A=E(e=>e.worktrees),P=E(e=>e.baseBranch),[F,I]=(0,M.useState)(``),[L,R]=(0,M.useState)(null),[z,B]=(0,M.useState)(!1),[V,H]=(0,M.useState)(!0),[U,W]=(0,M.useState)(!1),[G,K]=(0,M.useState)(!1),[q,ie]=(0,M.useState)(!1),J=D(e=>e.result),Y=D(e=>e.loading),X=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(X.current&&clearTimeout(X.current),!F.trim()){D.getState().clear();return}return X.current=setTimeout(()=>{D.getState().setLoading();let e=D.getState().nextSeq();n?.send?.({type:`goal.assess`,payload:{goal:F,seq:e}})},800),()=>{X.current&&clearTimeout(X.current)}},[F,n]),(0,M.useEffect)(()=>{!F.trim()&&!L&&D.getState().clear()},[F,L]);let Z=s.length>0,ae=L!=null&&!Z;(0,M.useEffect)(()=>{Z&&R(null)},[Z]);let Q=(0,M.useCallback)(()=>{let e=F.trim();if(!e||L!=null)return;let r=t.getState();r.addMessage({role:`user`,content:e}),r.addMessage({role:`assistant`,content:l.t(`activity:goalRun.planningAck`)}),R(e),I(``),n?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:V,multiBoard:U,verifyTasks:G,chimeraReview:q}}),O(`chat`)},[F,L,n,V]),oe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}}),R(null)},[n]),se=(0,M.useCallback)(()=>{n?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[n]),ce=(0,M.useCallback)(()=>{n?.send?.(y===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[n,y]),le=(0,M.useCallback)(()=>{n?.send?.({type:`goal.stop`,payload:{}})},[n]),ue=(0,M.useCallback)(()=>{n?.send?.({type:`goal.clear`,payload:{}}),T.getState().clear(),R(null),I(``)},[n]),[de,$]=(0,M.useState)(!1),fe=(0,M.useCallback)(()=>{n?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[n]),pe=y===`running`||y===`paused`,me=y===`stopped`||y===`completed`||y===`failed`,he=(0,M.useCallback)(e=>{e&&n?.send?.({type:`goal.load`,payload:{graphId:e}})},[n]);return(0,N.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,N.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(h,{className:`h-5 w-5 text-muted-foreground`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold`,children:Z&&f||`Goal`}),Z&&(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`activity:goalRun.summary`,{count:s.length,pct:c})})]}),Z&&(0,N.jsx)(`span`,{className:w(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,y===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:y===`paused`||y===`stopped`?`border-warning/40 bg-warning/10 text-warning`:y===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:b??void 0,children:y})]}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[C.length>0&&(0,N.jsxs)(`select`,{value:Z?C.find(e=>e.title===f)?.id??``:``,onChange:e=>he(e.target.value),title:a(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,N.jsx)(`option`,{value:``,disabled:!0,children:a(`activity:goalRun.boardsCount`,{count:C.length})}),C.map(e=>(0,N.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Z&&(0,N.jsxs)(`button`,{type:`button`,onClick:se,title:a(`activity:goalRun.toggleAutonomousTitle`),className:w(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,d?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,N.jsx)(x,{className:`h-3.5 w-3.5`}),` `,a(d?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ce,title:a(y===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[y===`paused`?(0,N.jsx)(S,{className:`h-3.5 w-3.5`}):(0,N.jsx)(v,{className:`h-3.5 w-3.5`}),a(y===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,N.jsxs)(`button`,{type:`button`,onClick:le,title:a(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,N.jsx)(r,{className:`h-3.5 w-3.5 fill-current`}),` `,a(`activity:goalRun.stop`)]})]}),Z&&me&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:ue,title:a(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,N.jsx)(i,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.newLabel`)]}),de?(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.revertConfirm`)}),(0,N.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:a(`common:action.yes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:a(`common:action.no`)})]}):(0,N.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:a(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,N.jsx)(o,{className:`h-3.5 w-3.5`}),` `,a(`activity:goalRun.revert`)]})]}),(0,N.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,N.jsx)(m,{className:`h-4 w-4`})})]})]}),Z&&p&&(0,N.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:p})]}),Z?(0,N.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,N.jsx)(re,{})}):ae?(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,N.jsx)(_,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,N.jsxs)(`div`,{className:`space-y-1`,children:[(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.planning`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.planningBody`)})]}),(0,N.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,N.jsx)(g,{className:`h-3 w-3`}),` `,a(`activity:goalRun.goal`)]}),(0,N.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:L})]}),(0,N.jsxs)(k,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,N.jsx)(r,{className:`h-4 w-4 fill-current`}),` `,a(`common:action.cancel`)]})]})}):(0,N.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,N.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,N.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,N.jsx)(g,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,N.jsx)(`h2`,{className:`text-xl font-semibold`,children:a(`activity:goalRun.startHeading`)}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`activity:goalRun.startBody`)})]}),(0,N.jsx)(`textarea`,{value:F,onChange:e=>I(e.target.value),placeholder:a(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),Q())}}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(_,{className:`h-3 w-3 animate-spin`}),a(`activity:goalRun.assess.analyzing`)]}),!Y&&J&&!J.parseFailed&&(0,N.jsxs)(`div`,{className:w(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,J.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,N.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:J.realistic?(0,N.jsx)(`span`,{className:`text-success`,children:a(`activity:goalRun.assess.realistic`)}):(0,N.jsx)(`span`,{className:`text-warning`,children:a(`activity:goalRun.assess.durationConcern`)})}),J.durationClaimed&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.durationClaimed`,{duration:J.durationClaimed})}),(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:J.explanation}),J.recommendedDuration&&(0,N.jsx)(`p`,{className:`text-muted-foreground`,children:a(`activity:goalRun.assess.recommendation`,{duration:J.recommendedDuration})}),J.concerns.length>0&&(0,N.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,N.jsx)(`p`,{className:`font-medium text-foreground/80`,children:a(`activity:goalRun.assess.concerns`)}),(0,N.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:J.concerns.map((e,t)=>(0,N.jsx)(`li`,{children:e},t))})]})]}),!Y&&J?.parseFailed&&(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:a(`activity:goalRun.assess.analysisFailed`)}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:V,onChange:e=>H(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.isolateLabel`)]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:U,onChange:e=>W(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.multiBoardLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>K(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.verifyTasksLabel`)]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:q,onChange:e=>ie(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),a(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!Y&&J&&!J.realistic&&!J.parseFailed&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>D.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:a(`activity:goalRun.assess.overrideTitle`),children:a(`activity:goalRun.assess.override`)}),(0,N.jsxs)(k,{onClick:Q,disabled:!F.trim()||L!=null||Y||!Y&&J!=null&&!J.parseFailed&&!J.realistic,className:`flex-1 gap-2`,title:F.trim()&&!Y&&J&&!J.parseFailed&&!J.realistic?a(`activity:goalRun.assess.disableTitle`):``,children:[(0,N.jsx)(S,{className:`h-4 w-4`}),a(`activity:goalRun.startButton`)]})]}),(0,N.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[a(`activity:goalRun.ctrlHint`),` ·`,` `,a(V?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),A.length>0&&(0,N.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:a(`activity:goalRun.lanes`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:w(`rounded px-2 py-0.5 border transition-colors`,z?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:a(`activity:goalRun.graph`)})]}),(0,N.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,N.jsx)(ne,{}),z?(0,N.jsx)(j,{worktrees:A,baseBranch:P}):(0,N.jsx)(te,{worktrees:A,baseBranch:P})]})]})]})}export{K as GoalView};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Bn as n,Bt as r,Cn as i,Er as a,Gn as o,Ii as s,Ki as c,Li as l,Mt as u,Nr as d,Oa as f,Ot as p,Pa as m,Qi as h,Qt as g,Si as _,St as v,Ti as y,Ui as b,Wi as x,Wt as S,Xi as C,Xr as w,Yt as T,Zn as ee,Zt as E,an as D,ar as O,cn as k,dt as A,fn as j,gi as M,hn as te,in as ne,ir as N,ji as re,jt as ie,kn as ae,la as oe,lt as se,mn as ce,oa as le,oi as ue,qt as de,un as fe,vi as pe,vn as me,wn as P,xa as F,za as he}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as I}from"./ws-client-TTMa0XaT.js";import{t as L}from"./utils-B-9lSDIn.js";import{t as ge}from"./session-store-Df7_hhe9.js";import{I as _e,T as ve,m as ye,p as be}from"./stores-ChEnUmic.js";import{n as R}from"./ui-store-CE4-TlwB.js";import{n as xe,t as Se}from"./ModelPicker-BbBZuQwR.js";import{b as Ce,c as we,x as Te}from"./index-CtpViiZy.js";import{n as z,t as Ee}from"./progress-ring-D_48qsBl.js";var B=e(he(),1);function De(e,t=!0){(0,B.useEffect)(()=>{let n=e.current;if(!n||!t)return;let r=e=>{if(!e.shiftKey||n.scrollWidth<=n.clientWidth+1)return;let t=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;t!==0&&(e.preventDefault(),n.scrollLeft+=t)},i=e=>{if(!e.ctrlKey&&!e.metaKey||n.scrollWidth<=n.clientWidth+1)return;let t=n.clientWidth*.8;e.key===`ArrowLeft`?(e.preventDefault(),n.scrollLeft-=t):e.key===`ArrowRight`&&(e.preventDefault(),n.scrollLeft+=t)};return n.addEventListener(`wheel`,r,{passive:!1}),n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`wheel`,r),n.removeEventListener(`keydown`,i)}},[e,t])}var Oe=4320*60*1e3,V=new Set([`completed`,`archived`]);function ke(e,t){let n=Ue(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=ze(t.liveAgentIdentities),i=Pe(e,t.defaultReviewStaleAfterMs??Oe),a=Ne(e),o=[];for(let s of e.tasks)V.has(s.status)||(H(o,s,t.requireDueDate===!0),Ae(o,s,n,r),je(o,s,n,i),a.length>1&&Me(o,s,a));return o.sort(We),{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 H(e,t,n){W(t.description)||G(e,t,`missing-description`,`warning`,`Add a description`),Le(t).length===0&&G(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&&!W(t.dueDate)&&G(e,t,`missing-due-date`,`warning`,`Set a due date`),!Ve(t.labels)&&!Ve(t.tags)&&G(e,t,`missing-labels`,`warning`,`Add labels or tags`),!Ve(t.childTaskIds)&&!Ve(t.subtasks)&&G(e,t,`missing-subtasks`,`warning`,`Define subtasks`),Ve(t.successCriteria)||G(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function Ae(e,t,n,r){let i=t.assignment;if(!(t.status===`in_progress`||i?.status===`running`))return;let a=Le(t);if(!i||a.length===0||!W(i.leaseId)||!W(i.leaseExpiresAt)){G(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=Ue(i.leaseExpiresAt);if(o===null||o<=n){G(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}a.some(e=>r.has(U(e)))||G(e,t,`abandoned-running-task`,`error`,`Assigned agent is not live`)}function je(e,t,n,r){if(t.status!==`review`)return;let i=Ie(t,`review`)??Ue(t.updatedAt);i===null||n-i<=r||G(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/(3600*1e3)))}h`)}function Me(e,t,n){let r=Fe(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[U(e),t]));for(let n=1;n<r.length;n+=1){let a=r[n-1],o=r[n];if(!a||!o)continue;let s=i.get(U(a.state)),c=i.get(U(o.state));if(!(s===void 0||c===void 0||Math.abs(c-s)<=1)){G(e,t,`skipped-lifecycle-state`,`error`,`Lifecycle skipped ${a.state} → ${o.state}`);return}}}function Ne(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=Re(e);if(t.length>1)return t;if(!e||typeof e!=`object`||Array.isArray(e))continue;let n=e;if(n.mode===`managed`&&n.columns){let e=[`backlog`,`todo`,`running`,`review`,`done`].map(e=>n.columns?.[e]).filter(e=>W(e));if(e.length===5)return e}for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=Re(e);if(t.length>1)return t}}return[]}function Pe(e,t){let n=[e,e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of n){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e;if(He(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(He(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(He(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function Fe(e){let t=e.lifecycle?.history??e.lifecycleHistory??e.statusHistory??e.history;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e==`string`&&W(e)){n.push({state:e.trim(),at:null});continue}if(!e||typeof e!=`object`)continue;let t=e,r=Be(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:Ue(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function Ie(e,t){let n=null;for(let r of Fe(e))U(r.state)!==U(t)||r.at===null||(n=n===null?r.at:Math.max(n,r.at));return n}function Le(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(W)}function Re(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(W(n)){t.push(n.trim());continue}if(!n||typeof n!=`object`)continue;let e=n,r=Be(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function ze(e){let t=new Set;if(!e)return t;for(let n of e)W(n)&&t.add(U(n));return t}function U(e){return e.trim().toLocaleLowerCase()}function Be(...e){for(let t of e)if(W(t))return t.trim();return null}function W(e){return typeof e==`string`&&e.trim().length>0}function Ve(e){return Array.isArray(e)&&e.length>0}function He(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Ue(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}if(typeof e==`number`)return Number.isFinite(e)?e:null;if(typeof e!=`string`||!e.trim())return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function G(e,t,n,r,i){e.push({id:`${t.id}:${n}`,taskId:t.id,taskTitle:t.title,code:n,severity:r,message:i})}function We(e,t){let n=Ge(e.severity)-Ge(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function Ge(e){return e===`error`?0:1}function Ke(e){let t=_e(e=>e.wsUrl),n=_e(e=>e.provider),r=_e(e=>e.model),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)({}),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(``);return(0,B.useEffect)(()=>{let e=I(t).on(`kanban.meta`,e=>{let t=e.payload?.data;t&&(a(t.tools??[]),s(t.skills??[]),l(t.fallbackProfiles??{}),t.sessionProvider&&d(t.sessionProvider),t.sessionModel&&p(t.sessionModel))});return()=>e()},[t]),(0,B.useEffect)(()=>{e&&I(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}var K=se();function q({options:e,selected:n,onChange:r,placeholder:a,emptyLabel:o}){let{t:s}=m(),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!c)return;let e=e=>{f.current&&!f.current.contains(e.target)&&l(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[c]);let p=(0,B.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),g=(0,B.useMemo)(()=>{let t=u.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,u]),_=e=>{r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,K.jsxs)(`div`,{ref:f,className:`relative`,children:[n.length>0&&(0,K.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:n.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:`max-w-[150px] truncate`,children:p(e)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${p(e)}`,children:(0,K.jsx)(A,{size:11})})]},e))}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2 py-1.5 text-left text-xs transition-colors hover:border-primary/45 hover:bg-muted/80`,children:[(0,K.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:a??`Add…`}),(0,K.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),c&&(0,K.jsxs)(`div`,{className:`absolute z-50 mt-1 max-h-72 w-full min-w-[240px] overflow-hidden rounded-md border border-border/80 bg-popover shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border/70 bg-muted/20 px-2 py-1.5`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:s(`activity:chipMultiSelect.filter`),className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),u&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>d(``),className:`text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(A,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`max-h-60 overflow-y-auto py-1`,children:[g.map(e=>{let r=n.includes(e.value);return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>_(e.value),className:L(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,r?`bg-primary/8 text-primary`:`text-foreground`),children:[r?(0,K.jsx)(t,{className:`mt-0.5 h-3 w-3 shrink-0 text-primary`}):(0,K.jsx)(`span`,{className:`w-3 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate`,children:e.label}),e.description&&(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.description})]}),e.tag&&(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0 font-mono text-[9px] text-muted-foreground`,children:e.tag})]},e.value)}),g.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?o??`Nothing available`:`No match`})]})]})]})}function qe(e){let t=Math.max(0,Date.now()-Date.parse(e));return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function Je(e,t){if(!e)return null;let n=Date.parse(e),r=t?Date.parse(t):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r))return null;let i=Math.max(0,Math.floor((r-n)/1e3));if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m`;let o=Math.floor(a/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function Ye({presence:e=[]}){let{t}=m();return e.length===0?null:(0,K.jsxs)(`section`,{"aria-label":t(`activity:kanban.boardPresence`),className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-card/50 px-4 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:t(`activity:kanban.liveBoardUsers`)}),e.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 text-xs shadow-sm`,title:`Session ${e.sessionId} · last seen ${e.lastSeenAt}`,children:[(0,K.jsx)(`span`,{role:`img`,"aria-label":e.active?`active`:`inactive`,className:L(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,K.jsx)(l,{size:13,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:e.agentName??e.agentId}),(0,K.jsx)(`span`,{className:`max-w-32 truncate text-muted-foreground`,children:e.sessionId}),(0,K.jsx)(re,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:qe(e.lastSeenAt)})]},e.id))]})}function Xe({board:e,snapshot:t,sendKanban:n}){let{t:r}=m(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!0),[c,l]=(0,B.useState)(`deterministic`),[u,d]=(0,B.useState)(`session`),[p,g]=(0,B.useState)(``),[_,v]=(0,B.useState)(``),[y,b]=(0,B.useState)(``),[x,S]=(0,B.useState)([]),[C,w]=(0,B.useState)([]),[T,ee]=(0,B.useState)(10),D=xe(i&&c===`agentic`),O=Ke(i&&c===`agentic`);(0,B.useEffect)(()=>{let t=e.supervisor;s(t?.enabled??!0),l(t?.mode??`deterministic`),d(t?.routing?.mode??`session`),g(t?.routing?.provider??``),v(t?.routing?.model??``),b(t?.routing?.fallbackProfile??``),S(t?.routing?.fallbackModels??[]),w(t?.skills??[]),ee(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,JSON.stringify(e.supervisor)]);let k=()=>{let t={mode:u,...u===`fixed`&&p?{provider:p}:{},...u===`fixed`&&_?{model:_}:{},...u===`fallback_profile`&&y?{fallbackProfile:y}:{},...x.length?{fallbackModels:x}:{}};n(`kanban.update`,{boardId:e.id,supervisor:{enabled:o,mode:c,intervalMs:Math.max(2,T)*1e3,recoveryMode:`auto`,...c===`agentic`?{routing:t,skills:C}:{}}}),window.setTimeout(()=>n(`kanban.supervisor.audit`,{boardId:e.id}),150)},A=o?t?.status??`starting`:`disabled`;return(0,K.jsxs)(`div`,{className:`shrink-0 border-b bg-background/80`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 px-4 py-1.5 text-left text-[11px] hover:bg-muted/40`,children:[(0,K.jsx)(E,{size:13,className:A===`healthy`?`text-success`:`text-warning`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:r(`activity:kanban.kanbanAgent`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[c,` · `,A]}),t?.summary&&(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:t.summary}),(0,K.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:t?.lastAuditAt?r(`activity:kanban.checkedAgo`,{ago:Je(t.lastAuditAt)}):r(`activity:kanban.notChecked`)}),(0,K.jsx)(h,{size:13,className:L(`transition-transform`,i&&`rotate-180`)})]}),i&&(0,K.jsxs)(`div`,{className:`grid gap-3 border-t p-3 text-xs lg:grid-cols-[220px_220px_1fr_auto]`,children:[(0,K.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border bg-card px-2 py-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),(0,K.jsx)(`span`,{children:r(`activity:kanban.watchThisBoard`)})]}),(0,K.jsx)(Ze,{label:r(`activity:kanban.supervisorEngine`),value:c,options:[`deterministic`,`agentic`],onChange:e=>l(e)}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.auditInterval`)}),(0,K.jsx)(`input`,{type:`number`,min:2,value:T,onChange:e=>ee(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:k,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,K.jsx)(fe,{size:13}),` `,r(`activity:boardChrome.save`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.supervisor.audit`,{boardId:e.id}),className:`inline-flex h-8 items-center gap-1 rounded-md border px-3 hover:bg-muted`,children:[(0,K.jsx)(f,{size:13}),` `,r(`activity:boardChrome.auditNow`)]})]}),c===`deterministic`?(0,K.jsx)(`div`,{className:`lg:col-span-4 rounded-md border border-success/20 bg-success/5 px-3 py-2 text-muted-foreground`,children:r(`activity:boardChrome.deterministicModeUsesNoProviderModel`)}):(0,K.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,K.jsx)(Ze,{label:r(`activity:kanban.kanbanAgentModelSource`),value:u,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>d(e)}),u===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:boardChrome.fixedProviderModel`)}),(0,K.jsx)(Se,{value:_||void 0,provider:p||void 0,candidates:D,placeholder:r(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{v(e),g(t)}})]}),u===`fallback_profile`&&(0,K.jsx)(Ze,{label:r(`activity:kanban.fallbackProfile`),value:y,options:Object.keys(O.fallbackProfiles),placeholder:r(`activity:kanban.selectProfile`),onChange:b}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.supervisorSkills`)}),(0,K.jsx)(q,{options:O.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:C,onChange:w,placeholder:r(`activity:kanban.forceLoadSkills`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:r(`activity:kanban.extraFallbackModels`)}),(0,K.jsx)(q,{options:D.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:x,onChange:S,placeholder:r(`activity:kanban.optionalFallbacks`)})]})]})]})]})}function Ze({label:e,value:t,options:n,onChange:r,placeholder:i}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsxs)(`select`,{value:t,onChange:e=>r(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`,children:[i&&(0,K.jsx)(`option`,{value:``,children:i}),n.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]})}function Qe(e){let t=new Set;for(let n of e)n.status===`running`&&(t.add(n.id),t.add(n.name));return t}function $e(e){let t=new Set;e.sessionId&&t.add(e.sessionId);for(let n of e.registrySessionIds)t.add(n);for(let n of e.agents)n.status===`running`&&n.sessionId&&t.add(n.sessionId);return[...t]}function et(e){return e?e.tasks.filter(e=>e.status===`in_progress`||e.assignment?.status===`running`||e.assignment?.status===`queued`).reduce((e,t)=>e+(t.costCeilingUsd??0),0):0}function tt(e){let t=e?.tags??[],n=t.includes(`sdd`)?`sdd`:t.includes(`goal`)?`goal`:null;if(!n)return null;let r=t.find(e=>e.startsWith(`run:`))?.slice(4);return{engine:n,...r?{runId:r}:{}}}function nt({boardTotal:e,activeBoardTotal:t,orphanedBoardTotal:n,activeBoardId:r,activeBoards:a,orphanedBoards:o,boardPage:s,boardPageSize:c,loading:l,newBoardTitle:u,onClose:d,onRefresh:f,onNewBoardTitleChange:p,onCreateBoard:h,onBoardSelect:g,onBoardPageChange:_}){let{t:v}=m();return(0,K.jsxs)(`aside`,{className:`flex max-h-[45dvh] w-full shrink-0 flex-col border-b bg-card/40 md:max-h-none md:w-[280px] md:border-b-0 md:border-r`,children:[(0,K.jsxs)(`div`,{className:`flex h-12 items-center gap-2 border-b px-3`,children:[(0,K.jsx)(`button`,{type:`button`,title:v(`common:action.back`),onClick:d,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(F,{size:16})}),(0,K.jsx)(y,{size:17,className:`text-primary`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:v(`activity:kanban.kanban`)}),(0,K.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[e,` boards · `,t,` active · `,n,` orphaned`]})]}),(0,K.jsx)(`button`,{type:`button`,title:v(`common:action.refresh`),onClick:f,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(me,{size:15,className:l?`animate-spin`:void 0})})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h()},placeholder:v(`activity:kanban.newBoard`),className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,title:v(`activity:kanban.createBoard`),onClick:h,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(i,{size:16})})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[a.length>0&&(0,K.jsxs)(`div`,{className:`mb-1 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-success`,children:[`Active session · `,a.length]}),a.map(e=>(0,K.jsx)(rt,{board:e,active:r===e.id,dotClassName:`bg-success`,onSelect:g},e.id)),o.length>0&&(0,K.jsxs)(`div`,{className:`mb-1 mt-2 px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[`No active session · `,o.length]}),o.map(e=>(0,K.jsx)(rt,{board:e,active:r===e.id,dotClassName:`bg-muted-foreground/45`,onSelect:g},e.id))]}),(0,K.jsx)(Ce,{page:s,pageSize:c,totalItems:e,onPageChange:_,compact:!0,itemLabel:`boards`})]})}function rt({board:e,active:t,dotClassName:n,onSelect:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:L(`mb-1 w-full rounded-md px-2 py-2 text-left transition-colors`,t?`bg-primary/10 text-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-between text-[11px]`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:L(`h-1.5 w-1.5 rounded-full`,n)}),e.taskCount,` tasks`]}),(0,K.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]})}var it={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function at({title:e,value:t,inherited:n,onSave:r}){let{t:i}=m(),[a,o]=(0,B.useState)(t??it),[s,c]=(0,B.useState)(st(t?.allow??[])),[l,u]=(0,B.useState)(st(t?.deny??[])),[d,f]=(0,B.useState)(null);return(0,B.useEffect)(()=>{o(t??it),c(st(t?.allow??[])),u(st(t?.deny??[])),f(null)},[t]),(0,K.jsxs)(`details`,{className:`rounded-md border border-primary/25 bg-primary/5`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2 text-xs font-semibold`,children:[(0,K.jsx)(E,{size:14,className:`text-primary`}),(0,K.jsx)(`span`,{children:e}),(0,K.jsx)(`span`,{className:`ml-auto font-normal text-muted-foreground`,children:t?.enabled?`${t.enforcement} · ${t.allow.length} allow · shell ${t.shellAccess}`:n?.enabled?`inherits board boundary`:`unrestricted`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[n?.enabled&&(0,K.jsx)(`div`,{className:`rounded border border-warning/25 bg-warning/10 px-2 py-1.5 text-muted-foreground`,children:i(`activity:kanbanBoundaryEditor.boardPolicyRemainsAuthoritativeThisTask`)}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:a.enabled,onChange:e=>o({...a,enabled:e.target.checked})}),i(`activity:kanban.enableLayer`)]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`label`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:i(`activity:kanban.outsideScope`)}),(0,K.jsxs)(`select`,{value:a.enforcement,onChange:e=>o({...a,enforcement:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:i(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:i(`activity:kanban.alwaysBlock`)})]})]}),(0,K.jsxs)(`label`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:i(`activity:kanbanBoundaryEditor.shellOpaqueTools`)}),(0,K.jsxs)(`select`,{value:a.shellAccess,onChange:e=>o({...a,shellAccess:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:i(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:i(`activity:kanban.alwaysBlock`)}),(0,K.jsx)(`option`,{value:`allow`,children:i(`activity:kanban.allow`)})]})]})]}),(0,K.jsx)(ot,{label:i(`activity:kanban.allowSelectors`),value:s,onChange:c}),(0,K.jsx)(ot,{label:i(`activity:kanban.denySelectors`),value:l,onChange:u}),(0,K.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`One per line: kind:access:path — for example directory:read_write:packages/webui or file:read:README.md. Kinds: file, directory, package, glob. If an access type has no allow selector, it remains unrestricted except for deny rules. `,i(`activity:kanban.crossPathSelectors`)]}),d&&(0,K.jsx)(`div`,{className:`text-destructive`,children:d}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=ct(s),t=ct(l);r({...a,allow:e,deny:t}),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},className:`inline-flex h-8 flex-1 items-center justify-center gap-2 rounded bg-primary text-primary-foreground`,children:[(0,K.jsx)(fe,{size:13}),` `,i(`activity:kanbanBoundaryEditor.saveBoundary`)]}),t&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:i(`activity:kanban.removeLayer`)})]})]})]})}function ot({label:e,value:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[10px] font-medium uppercase text-muted-foreground`,children:e}),(0,K.jsx)(`textarea`,{rows:3,value:t,onChange:e=>n(e.target.value),className:`w-full resize-y rounded border bg-background px-2 py-1.5 font-mono text-[11px] outline-none focus:border-primary`})]})}function st(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
+
`)}function ct(e){let t=new Set([`file`,`directory`,`package`,`glob`]),n=new Set([`read`,`write`,`read_write`]);return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,r)=>{let i=e.indexOf(`:`),a=e.indexOf(`:`,i+1);if(i<=0||a<=i+1||a===e.length-1)throw Error(`Boundary line ${r+1} must use kind:access:path.`);let o=e.slice(0,i),s=e.slice(i+1,a),c=e.slice(a+1).trim();if(!c)throw Error(`Boundary line ${r+1} must use kind:access:path.`);if(!t.has(o))throw Error(`Boundary line ${r+1} has unknown kind.`);if(!n.has(s))throw Error(`Boundary line ${r+1} has unknown access.`);return{kind:o,access:s,path:c}})}function lt({audit:e,onSelectTask:t}){let[n,r]=(0,B.useState)(!0),i=(0,B.useId)();if((0,B.useEffect)(()=>{e.issues.length>0&&r(!0)},[e.issues.length]),e.issues.length===0)return null;let a=ut(e.issues);return(0,K.jsxs)(`section`,{"aria-labelledby":`${i}-title`,className:`shrink-0 border-b border-warning/25 bg-card/95 shadow-[inset_0_1px_0_hsl(var(--warning)/0.08)]`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-10 flex-wrap items-center gap-2 px-3 py-2 sm:px-4`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-warning/25 bg-warning/10 text-warning`,children:(0,K.jsx)(S,{size:14,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{id:`${i}-title`,className:`text-xs font-semibold text-foreground`,children:[`Kanban Cleaner found `,e.issues.length,` `,e.issues.length===1?`issue`:`issues`]}),(0,K.jsxs)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:[e.affectedTaskCount,` `,e.affectedTaskCount===1?`card needs`:`cards need`,` attention`]})]})]}),e.counts.error>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-destructive/25 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive`,children:[(0,K.jsx)(c,{size:11,"aria-hidden":`true`}),` `,e.counts.error,` critical`]}),e.counts.warning>0&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-warning/25 bg-warning/10 px-2 py-0.5 text-[10px] font-medium text-warning`,children:[(0,K.jsx)(p,{size:11,"aria-hidden":`true`}),` `,e.counts.warning,` warning`]}),(0,K.jsx)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":i,"aria-label":n?`Collapse Kanban Cleaner issues`:`Expand Kanban Cleaner issues`,onClick:()=>r(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:(0,K.jsx)(h,{size:14,"aria-hidden":`true`,className:L(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,K.jsx)(`ul`,{id:i,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:a.map(({taskId:e,taskTitle:n,issues:r})=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Open ${n}: ${r.map(e=>e.message).join(`, `)}`,className:`group flex w-full items-start gap-2 rounded-md border border-border/70 bg-background/70 px-2.5 py-2 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,K.jsx)(`span`,{className:L(`mt-1 h-1.5 w-1.5 shrink-0 rounded-full`,r.some(e=>e.severity===`error`)?`bg-destructive shadow-[0_0_8px_hsl(var(--destructive)/0.55)]`:`bg-warning shadow-[0_0_8px_hsl(var(--warning)/0.45)]`),"aria-hidden":`true`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-[11px] font-semibold text-foreground group-hover:text-primary`,children:n}),(0,K.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-[10px] leading-4 text-muted-foreground`,children:r.map(e=>e.message).join(` · `)})]})]})},e))})]})}function ut(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}function dt({board:e,sendKanban:n,onSelectTask:r}){let{t:i}=m(),[a,o]=(0,B.useState)(!1),s=e.tasks.filter(e=>e.decomposition?.status===`proposed`);return s.length?(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-warning/30 bg-warning/5 px-4 py-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`flex w-full items-center gap-2 text-left text-xs font-semibold text-warning`,children:[a?(0,K.jsx)(C,{size:13}):(0,K.jsx)(h,{size:13}),(0,K.jsx)(k,{size:13}),s.length,` decomposition proposal`,s.length>1?`s`:``,` awaiting approval`]}),!a&&(0,K.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:s.map(a=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(a.id),className:`min-w-0 flex-1 truncate text-left hover:underline`,children:[a.title,(0,K.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`→ `,a.decomposition?.proposedSubtasks.length??0,` subtasks`]})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.approve`,{boardId:e.id,taskId:a.id,proposalId:a.decomposition.id}),className:`inline-flex items-center gap-1 rounded-md bg-success/10 px-2 py-1 text-[11px] font-medium text-success hover:bg-success/20`,children:[(0,K.jsx)(t,{size:12}),` `,i(`activity:kanbanDecomp.approve`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(`kanban.decomposition.reject`,{boardId:e.id,taskId:a.id,proposalId:a.decomposition.id}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive hover:bg-destructive/20`,children:[(0,K.jsx)(A,{size:12}),` `,i(`activity:kanbanDecomp.reject`)]})]},a.id))})]}):null}var ft=[`assessed`,`proposed`,`approval`,`applied`];function pt(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function mt({board:e,task:n,sendKanban:r,onSelectTask:i}){let{t:a}=m(),o=n.decomposition,s=pt(n),c=(0,B.useMemo)(()=>{if(!o)return null;let t=(o.appliedChildTaskIds??[]).map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return{tasks:[{id:n.id,shortId:`parent`,title:n.title,displayStatus:o.status===`applied`?`completed`:`in_progress`,priority:n.priority,deps:[]},...o.proposedSubtasks.map((e,r)=>{let i=t[r];return{id:i?.id??`proposed-${r}`,shortId:`s${r}`,title:e.title,displayStatus:i?i.status===`completed`?`completed`:i.status===`failed`?`failed`:i.status===`in_progress`?`in_progress`:`pending`:o.status===`approved`?`queued`:`pending`,priority:n.priority,deps:(e.dependsOnIndex??[]).map(e=>`s${e}`)}})],columns:[{label:a(`activity:kanbanDecomp.parent`),taskIds:[`parent`]},{label:o.status===`applied`?`Subtasks`:`Proposed subtasks`,taskIds:o.proposedSubtasks.map((e,t)=>`s${t}`)}],appliedChildren:t}},[e,o,n]);return!o&&!n.atomicityAssessment?null:(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,K.jsx)(k,{size:13}),a(`activity:kanbanDecomp.decomposition`)]}),(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1 text-[11px]`,children:[ft.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,K.jsx)(`span`,{className:`text-muted-foreground/50`,children:`→`}),(0,K.jsx)(`span`,{className:L(`rounded px-1.5 py-0.5`,o?.status===`rejected`&&t===2?`bg-destructive/10 text-destructive`:t<=s?`bg-primary/10 font-medium text-primary`:`bg-muted text-muted-foreground`),children:o?.status===`rejected`&&t===2?`rejected`:e})]},e)),n.atomicityAssessment&&(0,K.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[n.atomicityAssessment.verdict,` · score `,n.atomicityAssessment.score]})]}),!o&&n.atomicityAssessment?.verdict===`needs_decomposition`&&(0,K.jsxs)(`div`,{className:`rounded-md border border-warning/30 bg-warning/5 p-2 text-[11px] text-warning`,children:[a(`activity:kanbanDecomp.thisTaskShouldBeSplitBefore`),(0,K.jsx)(`ul`,{className:`ml-4 mt-1 list-disc`,children:n.atomicityAssessment.criteria.filter(e=>e.score<1).map(e=>(0,K.jsx)(`li`,{children:e.reason},e.id))})]}),o&&c&&(0,K.jsxs)(K.Fragment,{children:[o.rationale&&(0,K.jsxs)(`div`,{className:`mb-2 text-[11px] text-muted-foreground`,children:[`“`,o.rationale,`”`]}),(0,K.jsx)(`div`,{className:`h-64 overflow-hidden rounded-md border`,children:(0,K.jsx)(z,{tasks:c.tasks,columns:c.columns,onTaskClick:t=>{e.tasks.some(e=>e.id===t)&&i(t)}})}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-1 text-[11px]`,children:o.proposedSubtasks.map((e,t)=>(0,K.jsxs)(`li`,{className:`rounded bg-muted/40 px-2 py-1`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.title}),e.successCriteria?.length?(0,K.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`✓ `,e.successCriteria.join(` · `)]}):null]},`${e.title}-${t}`))}),o.status===`proposed`&&(0,K.jsxs)(`div`,{className:`mt-2 flex gap-1.5`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`kanban.decomposition.approve`,{boardId:e.id,taskId:n.id,proposalId:o.id}),className:`inline-flex items-center gap-1 rounded-md bg-success/10 px-2.5 py-1.5 text-xs font-medium text-success hover:bg-success/20`,children:[(0,K.jsx)(t,{size:13}),` `,a(`activity:kanbanDecomp.approveAmpSplit`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`kanban.decomposition.reject`,{boardId:e.id,taskId:n.id,proposalId:o.id}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/20`,children:[(0,K.jsx)(A,{size:13}),` `,a(`activity:kanbanDecomp.reject`)]})]}),o.status===`applied`&&c.appliedChildren.length>0&&(0,K.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:c.appliedChildren.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),className:`rounded-md border px-2 py-1 text-[11px] hover:bg-muted`,children:[e.title,(0,K.jsxs)(`span`,{className:`ml-1 text-muted-foreground`,children:[`[`,e.status,`]`]})]},e.id))}),o.status===`rejected`&&o.resolutionReason&&(0,K.jsxs)(`div`,{className:`mt-2 text-[11px] text-muted-foreground`,children:[`Rejected: `,o.resolutionReason]})]})]})}var ht=[`id`,`name`,`type`];function J(e){if(typeof e==`string`)return e.trim()||void 0;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;for(let e of ht){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function gt(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var _t=new Set([`completed`,`review`,`failed`]);function vt(e){let t={totalTasks:e.tasks.length,gradedTasks:0,passed:0,failed:0,needsHuman:0,incomplete:0,unverified:0,failingChecks:[],missingEvidence:[],needsDecomposition:[],pendingProposals:[]};for(let n of e.tasks){if(n.status===`archived`)continue;let e=n.verificationReport;if(_t.has(n.status)&&(t.gradedTasks+=1,e?e.verdict===`passed`?t.passed+=1:e.verdict===`failed`?t.failed+=1:e.verdict===`needs_human`?t.needsHuman+=1:t.incomplete+=1:t.unverified+=1),e)for(let r of e.checks)(r.status===`failed`||r.status===`error`)&&t.failingChecks.push({task:n,check:r}),(r.type===`agent`||r.type===`council`)&&r.status===`passed`&&!r.backingRefs?.length&&t.missingEvidence.push({task:n,check:r});!n.childTaskIds?.length&&n.atomicityAssessment?.verdict===`needs_decomposition`&&n.status!==`completed`&&t.needsDecomposition.push(n),n.decomposition?.status===`proposed`&&t.pendingProposals.push(n)}return t}function yt(e){let t=new Map(e.tasks.map(e=>[e.id,e])),n=new Set,r=(e,i)=>{n.add(e.id);let a=e.childTaskIds??[],o=[];for(let e of a){let a=t.get(e);!a||n.has(a.id)||o.push(r(a,i+1))}return{task:e,children:o,depth:i}},i=[];for(let a of e.tasks)a.parentTaskId&&t.get(a.parentTaskId)||n.has(a.id)||i.push(r(a,0));for(let t of e.tasks)n.has(t.id)||i.push(r(t,0));return i}function bt(e){let t=[],n=e=>{t.push(e);for(let t of e.children)n(t)};for(let t of e)n(t);return t}function xt(e,t){return e?.columns.find(e=>e.id===t)?.title??t}function St({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background px-2 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] uppercase text-muted-foreground`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-xs font-medium`,children:t})]})}function Y({label:e,value:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsx)(`input`,{value:t,onChange:e=>n(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`})]})}function Ct({label:e,value:t,options:n,placeholder:r,onChange:i}){return(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:e}),(0,K.jsxs)(`select`,{value:t,onChange:e=>i(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:[r&&(0,K.jsx)(`option`,{value:``,children:r}),n.map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))]})]})}function wt(e){let t=`rounded px-1.5 py-0.5`;return e===`critical`?`${t} bg-destructive/10 text-destructive`:e===`high`?`${t} bg-warning/10 text-warning`:e===`low`?`${t} bg-muted text-muted-foreground`:`${t} bg-info/10 text-info`}function Tt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Et(e){return e===`completed`||e===`failed`||e===`cancelled`}function Dt(e,t){return t?Math.round(e/t*100):0}function Ot(e,t,n,r=new Date){let i=[],a=n.filter(e=>e.taskId===t.id),o=a.filter(e=>e.type!==`task.created`),s=o.filter(e=>e.type!==`task.assignment.heartbeat`&&e.type!==`task.assignment.snapshot`),c=s.filter(e=>!!e.note?.trim()),l=t.assignment,u=r.getTime(),d=100,f=(e,t=0)=>{i.some(t=>t.id===e.id)||(i.push(e),d=Math.max(0,d-t))};t.dueDate&&![`completed`,`archived`].includes(t.status)&&Date.parse(t.dueDate)<u&&f({id:`overdue`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.overdueTitle`,detailKey:`activity:taskRisk.overdueDetail`,detailParams:{dueDate:String(t.dueDate),status:String(t.status)},remediationKey:`activity:taskRisk.overdueFix`});let p=(t.dependsOn??[]).filter(t=>!e.tasks.some(e=>e.id===t));p.length&&f({id:`missing-dependency`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.missingDependencyTitle`,detailKey:`activity:taskRisk.missingDependencyDetail`,detailParams:{count:p.length},remediationKey:`activity:taskRisk.missingDependencyFix`});let m=(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return n&&![`completed`,`archived`].includes(n.status)});m.length&&f({id:`unresolved-dependency`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.unresolvedDependencyTitle`,detailKey:`activity:taskRisk.unresolvedDependencyDetail`,detailParams:{count:m.length},remediationKey:`activity:taskRisk.unresolvedDependencyFix`}),(l?.status===`failed`||l?.error)&&f({id:`assignment-failed`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.assignmentFailedTitle`,...l.error??l.lastFailureKind?{detailKey:`activity:taskRisk.assignmentFailedDetail`,detailParams:{reason:String(l.error??l.lastFailureKind)}}:{detailKey:`activity:taskRisk.assignmentFailedDetailGeneric`},remediationKey:`activity:taskRisk.assignmentFailedFix`}),l?.status===`failed`&&l.maxAttempts!==void 0&&(l.attempt??0)>=l.maxAttempts&&f({id:`retry-exhausted`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.retryExhaustedTitle`,detailKey:`activity:taskRisk.retryExhaustedDetail`,detailParams:{used:l.attempt??0,max:String(l.maxAttempts)},remediationKey:`activity:taskRisk.retryExhaustedFix`}),l&&[`queued`,`running`].includes(l.status)&&l.leaseExpiresAt&&Date.parse(l.leaseExpiresAt)<=u&&f({id:`lease-expired`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.leaseExpiredTitle`,detailKey:`activity:taskRisk.leaseExpiredDetail`,detailParams:{expiresAt:String(l.leaseExpiresAt),status:String(l.status)},remediationKey:`activity:taskRisk.leaseExpiredFix`}),l?.status===`running`&&l.heartbeatAt&&u-Date.parse(l.heartbeatAt)>5*6e4&&f({id:`heartbeat-stale`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.staleHeartbeatTitle`,detailKey:`activity:taskRisk.staleHeartbeatDetail`,detailParams:{since:String(l.heartbeatAt)},remediationKey:`activity:taskRisk.staleHeartbeatFix`}),t.status===`in_progress`&&!l&&f({id:`unowned-in-progress`,severity:`warning`,category:`operational`,titleKey:`activity:taskRisk.noAssignmentTitle`,detailKey:`activity:taskRisk.noAssignmentDetail`,remediationKey:`activity:taskRisk.noAssignmentFix`});let h=(t.successCriteria??[]).filter(e=>e.status===`failed`),g=(t.successCriteria??[]).filter(e=>e.status===`pending`);h.length&&f({id:`failed-checks`,severity:t.status===`completed`?`critical`:`warning`,category:`operational`,titleKey:`activity:taskRisk.failedChecksTitle`,detailKey:`activity:taskRisk.failedChecksDetail`,detailParams:{count:h.length},remediationKey:`activity:taskRisk.failedChecksFix`}),t.status===`completed`&&g.length&&f({id:`completed-with-pending-checks`,severity:`critical`,category:`operational`,titleKey:`activity:taskRisk.pendingChecksTitle`,detailKey:`activity:taskRisk.pendingChecksDetail`,detailParams:{count:g.length},remediationKey:`activity:taskRisk.pendingChecksFix`}),a.length?a.some(e=>e.type===`task.created`)||f({id:`missing-creation-event`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.noProvenanceTitle`,detailKey:`activity:taskRisk.noProvenanceDetail`,remediationKey:`activity:taskRisk.noProvenanceFix`},10):f({id:`no-durable-events`,severity:`critical`,category:`audit`,titleKey:`activity:taskRisk.noEventsTitle`,detailKey:`activity:taskRisk.noEventsDetail`,remediationKey:`activity:taskRisk.noEventsFix`},25);let _=Dt(o.filter(e=>!!e.actor).length,o.length),v=Dt(o.filter(e=>!!e.sessionId).length,o.length),y=Dt(c.length,s.length);o.length&&_<100&&f({id:`actor-coverage`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.actorCoverageTitle`,detailKey:`activity:taskRisk.actorCoverageDetail`,detailParams:{percent:_},remediationKey:`activity:taskRisk.actorCoverageFix`},10),o.length&&v<100&&f({id:`session-coverage`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.sessionCoverageTitle`,detailKey:`activity:taskRisk.sessionCoverageDetail`,detailParams:{percent:v},remediationKey:`activity:taskRisk.sessionCoverageFix`},10),s.length&&y<50&&f({id:`reason-coverage`,severity:`info`,category:`audit`,titleKey:`activity:taskRisk.reasonCoverageTitle`,detailKey:`activity:taskRisk.reasonCoverageDetail`,detailParams:{percent:y},remediationKey:`activity:taskRisk.reasonCoverageFix`},10);let b={...Tt([...a].sort((e,t)=>t.ts.localeCompare(e.ts)).find(e=>e.type===`task.assigned`||e.type.startsWith(`task.assignment.`))?.after),...l??{}},x=!!(b.provider||b.model||b.modelRouting);l&&!x&&f({id:`missing-route`,severity:`warning`,category:`audit`,titleKey:`activity:taskRisk.noRouteTitle`,detailKey:`activity:taskRisk.noRouteDetail`,remediationKey:`activity:taskRisk.noRouteFix`},10);let S=!!(l?.lastResult||l?.error||a.some(e=>Et(String(Tt(e.after).status??``))&&!!e.note?.trim()));return Et(l?.status)&&!S&&f({id:`missing-terminal-evidence`,severity:`critical`,category:`audit`,titleKey:`activity:taskRisk.missingTerminalEvidenceTitle`,detailKey:`activity:taskRisk.missingTerminalEvidenceDetail`,detailParams:{status:String(l?.status)},remediationKey:`activity:taskRisk.missingTerminalEvidenceFix`},15),i.sort((e,t)=>{let n={critical:0,warning:1,info:2};return n[e.severity]-n[t.severity]}),{score:d,findings:i,critical:i.filter(e=>e.severity===`critical`).length,warnings:i.filter(e=>e.severity===`warning`).length,coverage:{durableEvents:a.length,actorPercent:_,sessionPercent:v,reasonPercent:y,hasExecutionRoute:x,hasTerminalEvidence:S}}}function kt(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 At({board:e,task:t,events:n}){let{t:r}=m(),i=Ot(e,t,n),a=Te(i.findings,8,t.id);return(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/10`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(g,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:r(`activity:taskRisk.riskAuditQuality`)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${i.score>=90?`bg-success/10 text-success`:i.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:r(`activity:taskRisk.auditScore`,{score:i.score})}),i.critical>0&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:r(`activity:taskRisk.criticalCount`,{count:i.critical})}),(0,K.jsx)(h,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[(0,K.jsx)(`div`,{className:`grid grid-cols-3 gap-1 text-center sm:grid-cols-6`,children:[[r(`activity:taskRisk.covEvents`),i.coverage.durableEvents],[r(`activity:taskRisk.covActor`),`${i.coverage.actorPercent}%`],[r(`activity:taskRisk.covSession`),`${i.coverage.sessionPercent}%`],[r(`activity:taskRisk.covReasons`),`${i.coverage.reasonPercent}%`],[r(`activity:taskRisk.covRoute`),i.coverage.hasExecutionRoute?r(`common:action.yes`):r(`common:action.no`)],[r(`activity:taskRisk.covOutcome`),i.coverage.hasTerminalEvidence?r(`common:action.yes`):r(`common:action.no`)]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`rounded border bg-background/70 px-1 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-semibold`,children:t}),(0,K.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),i.findings.length===0?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded border border-success/30 bg-success/5 px-2.5 py-2 text-[11px] text-success`,children:[(0,K.jsx)(x,{className:`size-4`}),` `,r(`activity:taskRisk.noDeterministicTaskRisksDetected`)]}):(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[a.pageItems.map(e=>(0,K.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${kt(e.severity)}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] font-semibold`,children:[e.category===`audit`?(0,K.jsx)(pe,{className:`size-3.5`}):(0,K.jsx)(p,{className:`size-3.5`}),r(e.titleKey),(0,K.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[r(`activity:taskRisk.cat.${e.category}`),` ·`,` `,r(`activity:taskRisk.sev.${e.severity}`)]})]}),(0,K.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:r(e.detailKey,e.detailParams??{})}),(0,K.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskRisk.next`)}),` `,r(e.remediationKey)]})]},e.id)),(0,K.jsx)(Ce,{page:a.page,pageSize:a.pageSize,totalItems:a.totalItems,onPageChange:a.setPage,compact:!0,itemLabel:r(`activity:taskRisk.itemLabel`)})]})]})]})}function jt(e,t,n){let r=t.assignment,i=Ot(e,t,[]).findings.filter(e=>e.category===`operational`),a=J(r?.provider),o=J(r?.model);return{owner:J(r?.name)??J(r?.agentId)??J(r?.role)??J(t.assignee)??J(t.assignedAgent)??`Unassigned`,route:a||o?`${a?`${a}/`:``}${o??`default`}`:r?.modelRouting===`session`?`session default`:`default route`,blockers:(t.dependsOn??[]).filter(t=>{let n=e.tasks.find(e=>e.id===t);return!n||![`completed`,`archived`].includes(n.status)}).length,attempts:r?.attempt?`${r.attempt}${r.maxAttempts?`/${r.maxAttempts}`:``}`:`0`,fallbackCount:+!!r?.fallbackProfile+(r?.fallbackModels?.length??0),activeUsers:(e.presence??[]).filter(e=>e.taskId===t.id&&e.active).length,failed:t.status===`failed`||r?.status===`failed`||!!r?.error,criticalRisks:i.filter(e=>e.severity===`critical`).length,warningRisks:i.filter(e=>e.severity===`warning`).length,verification:gt(t,n?.[`${e.id}:${t.id}`]),subtaskCounts:(()=>{let n=t.childTaskIds??[];if(!n.length)return null;let r=n.map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return r.length?{done:r.filter(e=>[`completed`,`review`,`archived`].includes(e.status)).length,total:r.length}:null})(),atomicityVerdict:t.atomicityAssessment?.verdict??null,evidenceCount:t.verificationReport?.attachments.length??0,pendingDecomposition:t.decomposition?.status===`proposed`}}function Mt({board:e,column:t,selectedTaskId:n,dragTaskId:r,setDragTaskId:i,onSelectTask:a,onDeleteTask:o,onMoveTask:s}){let{t:c}=m(),l=be(e=>e.verificationActivity),u=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order);return(0,K.jsxs)(`section`,{className:L(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,u.length===0?`w-[180px]`:`w-[310px]`),children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,K.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:u.length})]}),(0,K.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragOver:e=>e.preventDefault(),onDrop:n=>{n.preventDefault(),e.lifecycle?.mode!==`managed`&&r&&s(r,t.id),i(null)},children:u.map(t=>{let r=jt(e,t,l);return(0,K.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:()=>{e.lifecycle?.mode!==`managed`&&i(t.id)},onDragEnd:()=>i(null),className:L(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,n===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>a(t.id),className:`absolute inset-0 cursor-pointer rounded-md`}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative flex items-start gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(t.atomic||r.atomicityVerdict)&&(0,K.jsx)(`span`,{className:L(`shrink-0 rounded px-1 py-0.5 text-[10px] font-medium`,r.atomicityVerdict===`needs_decomposition`?`bg-destructive/15 text-destructive`:r.atomicityVerdict===`composite`?`bg-info/15 text-info`:r.atomicityVerdict===`borderline`||t.atomic?`bg-warning/15 text-warning`:`bg-muted text-muted-foreground`),title:r.atomicityVerdict?`Atomicity: ${r.atomicityVerdict}`:`Atomic task (subtree verification required)`,children:t.atomic?`atomic`:r.atomicityVerdict===`needs_decomposition`?`split me`:r.atomicityVerdict}),(0,K.jsx)(`span`,{className:`line-clamp-2 text-sm font-medium leading-5`,children:t.title})]}),t.description&&(0,K.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-4 text-muted-foreground`,children:t.description})]}),(0,K.jsx)(`button`,{type:`button`,title:c(`activity:kanban.deleteTask`),"aria-label":c(`activity:kanban.deleteTaskAria`,{title:t.title}),onClick:()=>o(t),className:`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,children:(0,K.jsx)(ie,{size:14})})]}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,K.jsx)(`span`,{className:wt(t.priority),children:t.priority}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:t.status}),r.owner!==`Unassigned`&&(0,K.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:r.owner}),t.assignment&&(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:r.route}),t.assignment?.attempt?(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,r.attempts]}):null,r.fallbackCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.fallbackCount,` fallback`]}),r.blockers>0?(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.blockers,` blocker`]}):null,r.activeUsers>0&&(0,K.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[r.activeUsers,` active`]}),r.failed&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:c(`activity:kanban.runFailed`)}),r.criticalRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[r.criticalRisks,` critical risk`]}),r.warningRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[r.warningRisks,` warning`]}),t.chain&&(0,K.jsxs)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:[`chain `,t.chain.order+1]}),t.assignment?.skills?.length?(0,K.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[t.assignment.skills.length,` skills`]}):null,r.verification!==`unverified`&&(0,K.jsxs)(`span`,{className:L(`rounded px-1.5 py-0.5`,r.verification===`passed`?`bg-success/10 text-success`:r.verification===`failed`?`bg-destructive/10 text-destructive`:`bg-warning/10 text-warning`),children:[`✓ `,r.verification]}),r.subtaskCounts&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[r.subtaskCounts.done,`/`,r.subtaskCounts.total,` subtasks`]}),r.evidenceCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:[r.evidenceCount,` evidence`]}),r.pendingDecomposition&&(0,K.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:c(`activity:kanban.splitPendingApproval`)})]})]},t.id)})})]})}function Nt({queueHealth:e,runningCostTotal:t}){let{t:n}=m();return(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4 border-b px-4 py-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:n(`activity:kanban.queueHealth`)}),e.counts.ready>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.claimableTasks`),className:`inline-flex items-center gap-1 text-success`,children:[e.counts.ready,` `,n(`activity:kanban.statusReady`)]}),e.counts.running>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.runningAssignments`),className:`inline-flex items-center gap-1 text-warning`,children:[e.counts.running,` `,n(`activity:kanban.statusRunning`)]}),e.counts.review>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.inReview`),className:`inline-flex items-center gap-1 text-primary`,children:[e.counts.review,` `,n(`activity:kanban.statusReview`)]}),e.counts.blocked>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.manuallyBlocked`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.blocked,` `,n(`activity:kanban.statusBlocked`)]}),e.counts.failed>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.failedTasks`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.failed,` `,n(`activity:kanban.statusFailed`)]}),e.dependencyBlocked.count>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.blockedByDeps`),className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[e.dependencyBlocked.count,` `,n(`activity:kanban.statusBlockedByDeps`)]}),e.staleAssignments.count>0&&(0,K.jsxs)(`span`,{title:n(`activity:kanban.expiredLeases`),className:`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[e.staleAssignments.count,` `,n(`activity:kanban.statusStale`)]}),e.heartbeatDue.count===0&&e.staleAssignments.count===0&&e.dependencyBlocked.count===0&&(0,K.jsx)(`span`,{className:`text-success`,children:n(`activity:kanban.healthy`)}),t>0&&(0,K.jsx)(`span`,{title:n(`activity:kanban.costCeilingSum`),className:`inline-flex items-center gap-1 text-info`,children:n(`activity:kanban.runningCost`,{cost:t.toFixed(2)})})]})}function Pt({runLink:e,sendRaw:t}){let{t:n}=m(),i=e.engine===`sdd`,a=i?`sdd.board`:`goal`,o=R(e=>e.setCurrentView),s=(n,r={})=>t(n,e.runId?{runId:e.runId,...r}:r),c=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium hover:bg-muted`;return(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-primary/5 px-4 py-1.5`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase text-primary`,children:[(0,K.jsx)(te,{size:11}),` `,e.engine]}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n(`activity:kanban.liveRunSteer`)}),i&&(0,K.jsxs)(`button`,{type:`button`,className:c,title:n(`activity:kanban.openLiveRun`),onClick:()=>o(`sddhub`),children:[(0,K.jsx)(te,{size:12}),` `,n(`activity:kanban.openLiveRun`)]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsxs)(`button`,{type:`button`,className:c,onClick:()=>s(`${a}.pause`),children:[(0,K.jsx)(ae,{size:12}),` `,n(`activity:kanban.actionPause`)]}),(0,K.jsxs)(`button`,{type:`button`,className:c,onClick:()=>s(`${a}.resume`),children:[(0,K.jsx)(P,{size:12}),` `,n(`activity:kanban.actionResume`)]}),i&&(0,K.jsxs)(`button`,{type:`button`,className:c,onClick:()=>s(`sdd.board.retry_all_failed`),children:[(0,K.jsx)(ce,{size:12}),` `,n(`activity:kanban.actionRetryFailed`)]}),(0,K.jsxs)(`button`,{type:`button`,className:L(c,`text-destructive hover:bg-destructive/10`),onClick:()=>s(`${a}.stop`),children:[(0,K.jsx)(r,{size:12}),` `,n(`activity:kanban.actionStop`)]})]})]})}function Ft({boardId:e,sendKanban:t}){let{t:n}=m(),r=`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium text-primary hover:bg-primary/10`;return(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b bg-muted/30 px-4 py-1.5`,children:[(0,K.jsx)(te,{size:13,className:`text-primary`}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n(`activity:kanban.runAsLiveJob`)}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,className:r,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:n(`activity:kanban.startAsGoal`)}),(0,K.jsx)(`button`,{type:`button`,className:r,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:n(`activity:kanban.startAsSdd`)})]})]})}function It({runLink:e,runTaskId:n,modelCandidates:i,sendRaw:a}){let{t:o}=m(),s=e.engine===`sdd`,[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(t,n={})=>a(t,e.runId?{runId:e.runId,...n}:n),p=`inline-flex flex-1 items-center justify-center gap-1 rounded-md border py-1.5 text-xs font-medium hover:bg-muted`,h=()=>{let e=u.trim();e&&(f(s?`sdd.board.reassign`:`goal.assignTask`,{taskId:n,agentName:e}),l(!1),d(``))};return(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border bg-primary/5 p-2.5`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-wide text-primary`,children:o(`activity:kanban.runControls`)}),s&&(0,K.jsxs)(`div`,{className:`mb-2`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:o(`activity:kanban.workerModel`)}),(0,K.jsx)(Se,{candidates:i,placeholder:o(`activity:kanban.setModelForTask`),onPick:(e,t)=>f(`sdd.board.set_task_model`,{taskId:n,model:e,provider:t})})]}),c?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h(),e.key===`Escape`&&l(!1)},placeholder:o(`activity:kanban.newWorkerName`),className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:h,className:`rounded-md bg-primary/10 px-2 py-1.5 text-primary`,children:(0,K.jsx)(t,{size:14})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`rounded-md bg-muted px-2 py-1.5`,children:(0,K.jsx)(A,{size:14})})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>f(s?`sdd.board.retry`:`goal.retryTask`,{taskId:n}),children:[(0,K.jsx)(ce,{size:13}),` `,o(`common:action.retry`)]}),(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>l(!0),children:[(0,K.jsx)(v,{size:13}),` `,o(`activity:kanban.actionReassign`)]}),s?(0,K.jsxs)(`button`,{type:`button`,className:L(p,`text-destructive hover:bg-destructive/10`),onClick:()=>f(`sdd.board.cancel_task`,{taskId:n}),children:[(0,K.jsx)(r,{size:13}),` `,o(`common:action.cancel`)]}):(0,K.jsxs)(`button`,{type:`button`,className:p,onClick:()=>f(`goal.runTask`,{taskId:n}),children:[(0,K.jsx)(P,{size:13}),` `,o(`activity:kanban.actionRunNow`)]})]})]})}var Lt={unverified:{labelKey:`activity:kanbanTree.verifyUnverified`,className:`bg-muted text-muted-foreground`,icon:T},running:{labelKey:`activity:kanbanTree.verifyVerifying`,className:`bg-info/10 text-info`,icon:N},passed:{labelKey:`activity:kanbanTree.verifyVerified`,className:`bg-success/10 text-success`,icon:E},failed:{labelKey:`activity:kanbanTree.verifyFailed`,className:`bg-destructive/10 text-destructive`,icon:de},needs_human:{labelKey:`activity:kanbanTree.verifyNeedsReview`,className:`bg-warning/10 text-warning`,icon:p},incomplete:{labelKey:`activity:kanbanTree.verifyIncomplete`,className:`bg-warning/10 text-warning`,icon:p}};function Rt({task:e}){return e.status===`completed`?(0,K.jsx)(t,{size:13,className:`text-success`}):e.status===`failed`?(0,K.jsx)(A,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,K.jsx)(N,{size:13,className:`animate-spin text-info`}):(0,K.jsx)(b,{size:13,className:`text-muted-foreground`})}function zt({board:e,selectedTaskId:t,onSelectTask:n}){let{t:r}=m(),i=be(e=>e.verificationActivity),a=(0,B.useMemo)(()=>bt(yt(e)),[e]);return a.length?(0,K.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:a.map(({task:a,depth:o,children:s})=>{let c=gt(a,i[`${e.id}:${a.id}`]),l=Lt[c],u=l.icon,d=a.atomicityAssessment?.verdict;return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>n(a.id),style:{paddingLeft:`${o*22+8}px`},className:L(`flex w-full items-center gap-2 rounded-md border py-1.5 pr-2 text-left text-xs transition-colors`,t===a.id?`border-primary bg-primary/5`:`border-transparent hover:border-primary/40 hover:bg-muted/40`),children:[s.length>0?(0,K.jsx)(C,{size:12,className:`shrink-0 text-muted-foreground`}):(0,K.jsx)(`span`,{className:`w-3 shrink-0`}),(0,K.jsx)(Rt,{task:a}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:a.title}),a.atomic&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-warning/15 px-1 py-0.5 text-[10px] text-warning`,children:`atomic`}),d&&d!==`atomic`&&(0,K.jsx)(`span`,{className:L(`shrink-0 rounded px-1 py-0.5 text-[10px]`,d===`needs_decomposition`?`bg-destructive/15 text-destructive`:d===`composite`?`bg-info/15 text-info`:`bg-warning/15 text-warning`),children:d===`needs_decomposition`?`split me`:d}),a.decomposition?.status===`proposed`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-warning/10 px-1 py-0.5 text-[10px] text-warning`,children:r(`activity:kanbanTree.proposalPending`)}),(0,K.jsxs)(`span`,{className:L(`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px]`,l.className),children:[(0,K.jsx)(u,{size:11,className:c===`running`?`animate-spin`:void 0}),r(l.labelKey)]})]})},a.id)})})}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:r(`activity:kanbanTree.noTasksOnThisBoardYet`)})}function Bt({label:e,value:t,tone:n}){return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,K.jsx)(`div`,{className:L(`text-xl font-bold`,n===`success`&&`text-success`,n===`destructive`&&`text-destructive`,n===`warning`&&`text-warning`,n===`muted`&&`text-muted-foreground`),children:t}),(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e})]})}function Vt({title:e,icon:t,tone:n,rows:r,onSelectTask:i}){return r.length?(0,K.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,K.jsxs)(`div`,{className:L(`flex items-center gap-2 border-b px-3 py-2 text-xs font-semibold`,n),children:[(0,K.jsx)(t,{size:14}),e,(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:r.length})]}),(0,K.jsx)(`ul`,{className:`divide-y`,children:r.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.taskId),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-xs hover:bg-muted/40`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.primary}),e.secondary&&(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.secondary})]})},e.id))})]}):null}function Ht({board:e,onSelectTask:t}){let{t:n}=m(),r=(0,B.useMemo)(()=>vt(e),[e]);return(0,K.jsxs)(`div`,{className:`h-full space-y-4 overflow-y-auto p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-4 rounded-md border bg-background p-4`,children:[(0,K.jsx)(Ee,{pct:r.gradedTasks?r.passed/r.gradedTasks*100:0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold`,children:n(`activity:kanban.definitionOfDone`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[r.passed,` of `,r.gradedTasks,` graded tasks verified passed ·`,` `,r.totalTasks,` tasks total`]})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[(0,K.jsx)(Bt,{label:`verified`,value:r.passed,tone:`success`}),(0,K.jsx)(Bt,{label:`failed`,value:r.failed,tone:`destructive`}),(0,K.jsx)(Bt,{label:n(`activity:verifyReport.verdictNeedsHuman`),value:r.needsHuman,tone:`warning`}),(0,K.jsx)(Bt,{label:`incomplete`,value:r.incomplete,tone:`warning`}),(0,K.jsx)(Bt,{label:`unverified`,value:r.unverified,tone:`muted`})]}),(0,K.jsx)(Vt,{title:n(`activity:kanban.failingChecks`),icon:de,tone:`text-destructive`,onSelectTask:t,rows:r.failingChecks.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:`${t.description}${t.error?` — ${t.error}`:``}`}))}),(0,K.jsx)(Vt,{title:n(`activity:kanban.evidenceMissing`),icon:p,tone:`text-warning`,onSelectTask:t,rows:r.missingEvidence.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:t.description}))}),(0,K.jsx)(Vt,{title:n(`activity:kanban.needsDecomposition`),icon:k,tone:`text-warning`,onSelectTask:t,rows:r.needsDecomposition.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`atomicity score ${e.atomicityAssessment?.score??`?`} — split before dispatch`}))}),(0,K.jsx)(Vt,{title:n(`activity:kanban.decompositionPending`),icon:T,tone:`text-info`,onSelectTask:t,rows:r.pendingProposals.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`${e.decomposition?.proposedSubtasks.length??0} proposed subtasks`}))}),r.failingChecks.length===0&&r.missingEvidence.length===0&&r.needsDecomposition.length===0&&r.pendingProposals.length===0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-success/30 bg-success/5 p-3 text-xs text-success`,children:[(0,K.jsx)(E,{size:14}),n(`activity:kanban.noOutstanding`)]})]})}var Ut={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 Wt(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 Gt({assignment:e}){let{t}=m(),n=e.status===`running`,r=Wt(e.dispatchedAt,e.completedAt),i=J(e.name)??J(e.agentId),a=J(e.role),o=J(e.provider),s=J(e.model),c=[];return i&&c.push({label:t(`activity:kanbanRun.agent`),value:i}),a&&c.push({label:t(`activity:kanbanRun.role`),value:a}),e.modelRouting&&c.push({label:t(`activity:kanbanRun.modelSource`),value:e.modelRouting}),(o||s)&&c.push({label:t(`activity:kanbanRun.model`),value:(0,K.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[o?`${o}/`:``,s??`—`]})}),e.subagentId&&c.push({label:t(`activity:kanban.subagent`),value:(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),r&&c.push({label:e.completedAt?t(`activity:kanban.duration`):t(`activity:kanban.elapsed`),value:r}),typeof e.attempt==`number`&&c.push({label:t(`activity:kanbanRun.attempt`),value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&c.push({label:t(`activity:kanbanRun.costCeiling`),value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&c.push({label:t(`activity:kanbanRun.fallbackProfile`),value:e.fallbackProfile}),e.fallbackModels?.length&&c.push({label:t(`activity:kanbanRun.fallbacks`),value:e.fallbackModels.join(` → `)}),e.skills?.length&&c.push({label:t(`activity:kanbanRun.skills`),value:e.skills.join(`, `)}),e.tools?.length&&c.push({label:t(`activity:kanbanRun.tools`),value:e.tools.join(`, `)}),e.leaseExpiresAt&&c.push({label:t(`activity:kanbanRun.leaseExpires`),value:new Date(e.leaseExpiresAt).toLocaleString()}),(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border bg-background p-2.5`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:t(`activity:kanban.liveRun`)}),(0,K.jsxs)(`span`,{className:L(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,Ut[e.status]??`bg-muted text-muted-foreground`),children:[n&&(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),c.length>0&&(0,K.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:c.map(e=>(0,K.jsxs)(`div`,{className:`contents`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,K.jsx)(`dd`,{className:`min-w-0 truncate text-right text-foreground`,children:e.value})]},e.label))}),e.lastResult&&(0,K.jsxs)(`div`,{className:`mt-2`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:t(`activity:kanban.lastResult`)}),(0,K.jsx)(`div`,{className:`max-h-24 overflow-y-auto whitespace-pre-wrap rounded bg-muted px-2 py-1 text-[11px] leading-relaxed text-foreground`,children:e.lastResult})]}),e.error&&(0,K.jsx)(`div`,{className:`mt-2 rounded border border-destructive/30 bg-destructive/10 px-2 py-1 text-[11px] text-destructive`,children:e.error})]})}function Kt({activityKind:e,activityOutcome:t,note:n,details:r,onActivityKindChange:a,onActivityOutcomeChange:o,onNoteChange:s,onDetailsChange:c,onRecordActivity:l}){let{t:u}=m();return(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:u(`activity:kanbanRecorder.recordDecisionOutcome`)}),(0,K.jsxs)(`div`,{className:`mb-1.5 grid grid-cols-2 gap-1.5`,children:[(0,K.jsx)(`select`,{value:e,onChange:e=>a(e.target.value),"aria-label":u(`activity:kanbanRecorder.taskActivityKind`),className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`decision`,`attempt`,`result`,`blocker`,`observation`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))}),(0,K.jsx)(`select`,{value:t,onChange:e=>o(e.target.value),"aria-label":u(`activity:kanbanRecorder.taskActivityOutcome`),className:`h-8 rounded-md border bg-background px-2 text-xs`,children:[`unknown`,`succeeded`,`failed`,`partial`,`skipped`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]}),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{value:n,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&l(),placeholder:u(`activity:kanbanRecorder.whatWasDecidedAttemptedOrProduced`),className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:l,className:`h-8 rounded-md border px-2 hover:bg-muted`,"aria-label":u(`activity:kanbanRecorder.recordTaskDecisionOrOutcome`),children:(0,K.jsx)(i,{size:14})})]}),(0,K.jsx)(`input`,{value:r,onChange:e=>c(e.target.value),placeholder:u(`activity:kanbanRecorder.optionalEvidenceRationaleCommandLinkOrFailureDetail`),"aria-label":u(`activity:kanbanRecorder.taskActivityDetails`),className:`mt-1.5 h-8 w-full rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`})]})}function qt({board:e,task:n,newCheck:r,onNewCheckChange:a,onAddCheck:o,sendKanban:s}){let{t:c}=m();return(0,K.jsxs)(`div`,{className:`mt-5`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase text-muted-foreground`,children:c(`activity:kanbanTaskCompletionChecks.completionChecks`)}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(n.successCriteria??[]).map(r=>(0,K.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr_92px] items-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs`,children:[(0,K.jsx)(t,{size:13,className:r.status===`passed`?`text-success`:`text-muted-foreground`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:r.description}),(0,K.jsx)(`select`,{value:r.status,onChange:t=>s(`kanban.task.check.update`,{boardId:e?.id,taskId:n.id,checkId:r.id,status:t.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]},r.id)),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{value:r,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&o(),placeholder:c(`activity:kanbanTaskCompletionChecks.addAVerifiableCompletionCheck`),className:`h-8 min-w-0 flex-1 rounded-md border bg-background px-2 text-xs outline-none focus:border-primary`}),(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,K.jsx)(i,{size:14})})]})]})]})}var Jt=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Yt=[{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 Xt(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function Zt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Qt(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?X(Zt(e.after).outcome)===`failed`?`failures`:e.type===`task.activity.attempt`?`execution`:`notes`:e.type.includes(`failed`)||e.type.includes(`cancelled`)?`failures`:e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type.startsWith(`task.assignment.`)||e.type===`task.stale_recovered`?`execution`:e.type.includes(`note`)||e.type.includes(`check`)||e.type.includes(`metric`)?`notes`:`changes`}function $t(e){let t=Zt(e.before),n=Zt(e.after);return[...new Set([...Object.keys(t),...Object.keys(n)])].filter(e=>JSON.stringify(t[e])!==JSON.stringify(n[e])).map(e=>({field:e,before:t[e],after:n[e]}))}function en(e){if(e.type.startsWith(`task.file.`))return`File ${e.type.slice(10)}`.replace(/\b\w/g,e=>e.toUpperCase());if(e.type.startsWith(`task.activity.`))return`Recorded ${e.type.slice(14)}`.replace(/\b\w/g,e=>e.toUpperCase());switch(e.type){case`task.created`:return`Task created`;case`task.copied`:return`Task copied`;case`task.updated`:return`Task contract updated`;case`task.moved`:return`Task moved`;case`task.assigned`:return`Agent assigned`;case`task.claimed`:return`Task claimed`;case`task.released`:return`Assignment released`;case`task.assignment.updated`:return`Assignment updated`;case`task.assignment.running`:return`Agent started work`;case`task.assignment.completed`:return`Agent completed work`;case`task.assignment.failed`:return`Agent run failed`;case`task.assignment.cancelled`:return`Agent run cancelled`;case`task.assignment.heartbeat`:return`Agent heartbeat`;case`task.note.added`:return`Operator note added`;case`task.check.added`:return`Acceptance check added`;case`task.check.updated`:return`Acceptance check updated`;case`task.metric.added`:return`Goal metric added`;case`task.metric.updated`:return`Goal metric updated`;case`task.lifecycle.transition`:return`Lifecycle advanced`;case`task.assignment.snapshot`:return`Current assignment observed`;case`task.stale_recovered`:return`Stale assignment recovered`;case`task.reconciled`:return`Task state reconciled`;default:return e.type.replace(/^task\./,``).replaceAll(`.`,` `).replace(/\b\w/g,e=>e.toUpperCase())}}function tn(e){let t=Zt(e.before),n=Zt(e.after);if(e.type.startsWith(`task.file.`)){let e=X(n.filePath),t=X(n.toolName),r=typeof n.durationMs==`number`?n.durationMs:void 0,i=typeof n.lines==`number`?n.lines:void 0;return[e,t?`tool:${t}`:void 0,r===void 0?void 0:`${r}ms`,i===void 0?void 0:`${i} lines`].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.activity.`))return[X(n.outcome),X(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=X(t.columnId),r=X(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=$t(e);if(t.length)return`${t.length} field${t.length===1?``:`s`} changed: ${t.map(e=>e.field).join(`, `)}`}if(e.type===`task.lifecycle.transition`){let e=X(t.stage),r=X(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=X(n.name)??X(n.agentId)??X(n.role),t=X(n.provider),r=X(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[X(n.description),X(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[X(n.name),X(n.status)].filter(Boolean).join(` · `)||void 0}function nn(e){let t=e.type;return X(Zt(e.after).outcome)===`failed`||t.includes(`failed`)||t.includes(`cancelled`)?`bg-destructive ring-destructive/20`:t.includes(`completed`)||t.includes(`reconciled`)?`bg-success ring-success/20`:t.includes(`running`)||t.includes(`claimed`)||t.includes(`assigned`)?`bg-info ring-info/20`:t.includes(`note`)?`bg-warning ring-warning/20`:`bg-primary ring-primary/20`}function rn(e){let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(t):e}function an(e){if(e===void 0)return`unset`;if(e===null)return`none`;if(typeof e==`string`)return e||`empty`;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function on(e,t,n){let r=t.filter(t=>t.taskId===e.id).map(e=>({...e}));(e=>r.some(t=>t.type===e))(`task.created`)||r.push({id:`created:${e.id}`,boardId:``,taskId:e.id,type:`task.created`,ts:e.createdAt,...n?{sessionId:n}:{},after:{title:e.title,status:`created`,columnId:e.columnId}});for(let[t,i]of(e.lifecycle?.history??[]).entries())r.some(e=>e.type===`task.lifecycle.transition`&&e.ts===i.at&&e.actor===i.actor)||r.push({id:`lifecycle:${e.id}:${t}`,boardId:``,taskId:e.id,type:`task.lifecycle.transition`,ts:i.at,actor:i.actor,...n?{sessionId:n}:{},before:i.from?{stage:i.from}:void 0,after:{stage:i.to,action:i.action,attachment:i.attachment},note:i.comment});for(let t of e.notes??[])r.some(e=>e.type===`task.note.added`&&e.note===t.content&&Math.abs(Date.parse(e.ts)-Date.parse(t.createdAt))<2e3)||r.push({id:`note:${t.id}`,boardId:``,taskId:e.id,type:`task.note.added`,ts:t.createdAt,actor:t.author,...n?{sessionId:n}:{},note:t.content});let i=r.some(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`));return e.assignment&&!i&&r.push({id:`assignment:${e.id}`,boardId:``,taskId:e.id,type:`task.assignment.snapshot`,ts:e.assignment.completedAt??e.assignment.dispatchedAt??e.assignment.claimedAt??e.updatedAt,actor:e.assignment.agentId??e.assignment.name??e.assignment.role,...n?{sessionId:n}:{},subagentId:e.assignment.subagentId,runTaskId:e.assignment.runTaskId,after:{...e.assignment},note:e.assignment.error??e.assignment.lastResult}),r.sort((e,t)=>t.ts.localeCompare(e.ts))}function sn({event:e}){let t=Zt(e.after),n=X(t.provider),r=X(t.model),i=X(t.modelRouting),a=X(t.fallbackProfile),o=Array.isArray(t.fallbackModels)?t.fallbackModels.filter(e=>typeof e==`string`):[],s=typeof t.attempt==`number`?t.attempt:void 0,c=typeof t.maxAttempts==`number`?t.maxAttempts:void 0,l=X(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,K.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[l&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`status:`,l]}),i&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`route:`,i]}),(n||r)&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`model:`,n?`${n}/`:``,r??`default`]}),a&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`profile:`,a]}),o.map((e,t)=>(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`fallback-`,t+1,`:`,e]},`${e}:${t}`)),s!==void 0&&(0,K.jsxs)(`span`,{className:`rounded border border-border/60 px-1.5 py-0.5`,children:[`attempt:`,s,c?`/${c}`:``]})]})}function cn({task:e,events:n,sessionId:r,loading:i=!1,error:a,onRefresh:o}){let{t:s}=m(),[c,l]=(0,B.useState)(`all`),[u,d]=(0,B.useState)(``),[p,h]=(0,B.useState)(!1),g=(0,B.useMemo)(()=>on(e,n,r),[e,n,r]),v=(0,B.useMemo)(()=>({all:g.length,execution:g.filter(e=>Qt(e)===`execution`).length,changes:g.filter(e=>Qt(e)===`changes`).length,notes:g.filter(e=>Qt(e)===`notes`).length,failures:g.filter(e=>Qt(e)===`failures`).length}),[g]),y=(0,B.useMemo)(()=>{let e=u.trim().toLowerCase();return g.filter(t=>c!==`all`&&Qt(t)!==c?!1:!e||[en(t),t.type,t.actor,t.sessionId,t.subagentId,t.runTaskId,t.note,JSON.stringify(t.before),JSON.stringify(t.after)].filter(Boolean).join(` `).toLowerCase().includes(e))},[g,c,u]),b=Te(y,50,`${c}:${u}`),x=b.pageItems,S=[...new Set(g.map(e=>e.actor).filter(Boolean))].length,C=[...new Set(g.map(e=>e.sessionId??r).filter(Boolean))].length;return(0,K.jsxs)(`section`,{"aria-label":s(`activity:taskTimeline.taskActivity`),className:`mt-5`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(f,{className:`size-3.5 text-primary`}),(0,K.jsx)(`h3`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:s(`activity:taskTimeline.activityLedger`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] tabular-nums text-muted-foreground`,children:[y.length,`/`,g.length]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(JSON.stringify(Xt(e,y,`filtered`),null,2)),h(!0)}catch{h(!1)}},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.copyVisibleTaskActivityJson`),title:s(`activity:taskTimeline.copyFilteredActivityJson`),children:p?(0,K.jsx)(t,{className:`size-3 text-success`}):(0,K.jsx)(_,{className:`size-3`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Xt(e,g,`full`),null,2),n=URL.createObjectURL(new Blob([t],{type:`application/json`})),r=document.createElement(`a`);r.href=n,r.download=`${e.title.replace(/[^a-z0-9]+/gi,`-`).replace(/^-|-$/g,``).toLowerCase()||e.id}-activity.json`,r.click(),URL.revokeObjectURL(n)},className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.downloadFullTaskActivityJson`),title:s(`activity:taskTimeline.downloadFullActivityJson`),children:(0,K.jsx)(M,{className:`size-3`})}),o&&(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":s(`activity:taskTimeline.refreshTaskActivity`),children:(0,K.jsx)(me,{className:L(`size-3`,i&&`animate-spin`)})})]})]}),(0,K.jsx)(`div`,{className:`mb-2 grid grid-cols-4 gap-px overflow-hidden rounded-md border border-border/60 bg-border/60 text-center`,children:[[`Events`,g.length],[`Actors`,S],[`Sessions`,C],[`Failures`,v.failures]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`bg-background/90 px-1 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold tabular-nums`,children:t}),(0,K.jsx)(`div`,{className:`text-[8px] uppercase text-muted-foreground`,children:e})]},String(e)))}),(0,K.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-1`,children:[`all`,`execution`,`changes`,`notes`,`failures`].map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l(e),className:L(`rounded border px-1.5 py-1 text-[9px] capitalize`,c===e?`border-primary/50 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[e,` `,v[e]]},e))}),(0,K.jsxs)(`div`,{className:`relative mb-3`,children:[(0,K.jsx)(D,{className:`pointer-events-none absolute left-2 top-1/2 size-3 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),"aria-label":s(`activity:taskTimeline.searchTaskActivity`),placeholder:s(`activity:taskTimeline.searchAgentSessionModelResultField`),className:`h-8 w-full rounded-md border bg-background pl-7 pr-7 text-[11px] outline-none focus:border-primary`}),u&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>d(``),"aria-label":s(`activity:taskTimeline.clearTaskActivitySearch`),className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,K.jsx)(A,{className:`size-3`})})]}),a&&(0,K.jsx)(`div`,{className:`mb-2 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] text-destructive`,children:a}),y.length===0?(0,K.jsx)(`div`,{className:`rounded-md border border-dashed px-3 py-6 text-center text-[11px] text-muted-foreground`,children:s(`activity:taskTimeline.noActivityMatchesThisFilter`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ol`,{className:`relative ml-1.5 space-y-0 border-l border-border/70`,children:x.map(e=>{let t=tn(e),n=e.sessionId??r,i=$t(e),a=Qt(e)===`failures`,o=e.type.includes(`completed`)||X(Zt(e.after).outcome)===`succeeded`;return(0,K.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,K.jsx)(`span`,{className:L(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,nn(e))}),(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-xs font-medium leading-5`,children:en(e)}),(0,K.jsx)(`code`,{className:`block truncate text-[8px] text-muted-foreground/70`,title:e.type,children:e.type})]}),(0,K.jsx)(`time`,{dateTime:e.ts,title:new Date(e.ts).toLocaleString(),className:`shrink-0 text-[9px] text-muted-foreground`,children:rn(e.ts)})]}),t&&(0,K.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-[11px] leading-4 text-muted-foreground`,children:t}),e.note&&(0,K.jsxs)(`div`,{className:L(`mt-1.5 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border px-2 py-1.5 text-[10px] leading-4`,a?`border-destructive/30 bg-destructive/5 text-destructive`:o?`border-success/30 bg-success/5 text-success`:`border-border/70 bg-muted/35 text-foreground`),children:[(0,K.jsxs)(`strong`,{children:[a?`Error`:o?`Result`:`Reason / result`,`:`]}),` `,e.note]}),i.length>0&&e.type!==`task.assigned`&&e.type!==`task.assignment.snapshot`&&!e.type.startsWith(`task.file.`)&&(0,K.jsx)(`div`,{className:`mt-1.5 space-y-1 rounded border border-border/60 bg-background/50 p-1.5`,children:i.map(e=>(0,K.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-1.5 text-[9px] leading-4`,children:[(0,K.jsx)(`code`,{className:`truncate text-primary`,title:e.field,children:e.field}),(0,K.jsxs)(`span`,{className:`min-w-0 break-all text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`line-through opacity-70`,children:an(e.before)}),` `,(0,K.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,K.jsx)(`span`,{className:`text-foreground`,children:an(e.after)})]})]},e.field))}),(0,K.jsx)(sn,{event:e}),(e.actor||n||e.subagentId||e.runTaskId||e.correlationId)&&(0,K.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1 font-mono text-[9px] text-muted-foreground`,children:[e.actor&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`agent:`,e.actor]}),n&&(0,K.jsxs)(`span`,{className:`max-w-52 truncate rounded bg-muted px-1.5 py-0.5`,title:n,children:[`session:`,n]}),e.subagentId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`subagent:`,e.subagentId]}),e.runTaskId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`run:`,e.runTaskId]}),e.correlationId&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[`trace:`,e.correlationId]})]}),(0,K.jsxs)(`details`,{className:`mt-1.5 text-[9px] text-muted-foreground`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer hover:text-foreground`,children:s(`activity:taskTimeline.fullEventPayload`)}),(0,K.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto rounded border bg-muted/30 p-2 text-[9px] leading-4 text-foreground`,children:JSON.stringify(e,null,2)})]})]},e.id)})}),(0,K.jsx)(Ce,{page:b.page,pageSize:b.pageSize,totalItems:b.totalItems,onPageChange:b.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function ln(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function un(e){return e.type===`task.assigned`||e.type===`task.claimed`||e.type===`task.released`||e.type===`task.assignment.snapshot`||e.type===`task.stale_recovered`||e.type.startsWith(`task.assignment.`)}function dn(e,t){return Z(t.status)||(e.type===`task.claimed`?`claimed`:e.type===`task.released`?`released`:e.type===`task.stale_recovered`?`recovered`:e.type.split(`.`).at(-1)??`unknown`)}function fn(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function pn(e,t){if(!t)return;let n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)?Math.max(0,r-n):void 0}function mn(e,t,n){let r=on(e,t,n).filter(un).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=ln(e.after),r=Number(t.attempt),c=e.type===`task.assigned`||e.type===`task.claimed`;Number.isFinite(r)&&r>0?a=Math.trunc(r):c&&(a===0||s)?a=o+1:a===0&&(a=1),o=Math.max(o,a);let l=dn(e,t),u=i.get(a)??{attempt:a,status:l,startedAt:e.ts,fallbackModels:[],sessionIds:new Set,eventCount:0};u.status=l,u.eventCount+=1,(e.sessionId??n)&&u.sessionIds.add(e.sessionId??n),u.owner=Z(t.name)??Z(t.agentId)??Z(t.role)??e.actor??u.owner,u.provider=Z(t.provider)??u.provider,u.model=Z(t.model)??u.model,u.routingMode=Z(t.modelRouting)??u.routingMode,u.fallbackProfile=Z(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??Z(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??Z(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=Z(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=Z(t.error)??e.note??u.error),fn(l)&&(u.endedAt=e.ts),i.set(a,u),s=fn(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:pn(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function hn(e){if(e===void 0)return`running`;if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function gn(e){return e===`completed`?`bg-success/10 text-success`:e===`failed`||e===`cancelled`?`bg-destructive/10 text-destructive`:e===`running`?`bg-info/10 text-info`:`bg-muted text-muted-foreground`}function _n({task:e,events:t,sessionId:n}){let{t:r}=m(),i=mn(e,t,n),o=Te(i,8,e.id);return i.length?(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-border/70 bg-muted/15`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(a,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:r(`activity:taskExecutionAttempts.executionAttempts`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[i.length,` total`]}),(0,K.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${gn(i[0].status)}`,children:[`latest:`,i[0].status]}),(0,K.jsx)(h,{className:`ml-auto size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 p-2.5`,children:[o.pageItems.map(e=>(0,K.jsxs)(`section`,{className:`rounded-md border bg-background/70 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,K.jsxs)(`strong`,{className:`text-xs`,children:[`Attempt #`,e.attempt]}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${gn(e.status)}`,children:e.status}),(0,K.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 text-muted-foreground`,children:[(0,K.jsx)(u,{className:`size-3`}),` `,hn(e.durationMs),` · `,e.eventCount,` `,`events`]})]}),(0,K.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[10px] text-muted-foreground sm:grid-cols-2`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(oe,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,K.jsx)(j,{className:`size-3`}),e.provider||e.model?`${e.provider?`${e.provider}/`:``}${e.model??`default`}`:e.routingMode??`default route`]}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[`session:`,e.sessionIds.join(`, `)||`unknown`]}),(0,K.jsxs)(`span`,{className:`font-mono`,children:[`subagent:`,e.subagentId??`—`,` · run:`,e.runTaskId??`—`]})]}),(e.fallbackProfile||e.fallbackModels.length>0)&&(0,K.jsxs)(`p`,{className:`mt-1.5 break-all font-mono text-[9px] text-muted-foreground`,children:[`fallback:`,[e.fallbackProfile?`profile:${e.fallbackProfile}`:``,...e.fallbackModels].filter(Boolean).join(` → `)]}),e.error&&(0,K.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[10px] text-destructive`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskExecutionAttempts.error`)}),` `,e.error]}),e.result&&(0,K.jsxs)(`p`,{className:`mt-2 max-h-32 overflow-y-auto whitespace-pre-wrap rounded border border-success/30 bg-success/5 px-2 py-1.5 text-[10px] text-success`,children:[(0,K.jsx)(`strong`,{children:r(`activity:taskExecutionAttempts.result`)}),` `,e.result]})]},e.attempt)),(0,K.jsx)(Ce,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function vn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Q(e){return J(e)}function yn(e,t){return(t??[]).map(t=>{let n=e.tasks.find(e=>e.id===t);return{id:t,title:n?.title??t,status:n?.status??`missing`}})}function bn(e,t,n,r,i,a,o){let s=on(t,n,r),c=yn(e,t.dependsOn),l=c.filter(e=>![`completed`,`archived`].includes(e.status)),u=t.assignment,d=(o??e.presence??[]).filter(e=>e.taskId===t.id),f=vn(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Q(u?.modelRouting)??Q(f.modelRouting)??`session`,m=Q(u?.provider)??Q(f.provider)??(p===`session`?Q(i):void 0),h=Q(u?.model)??Q(f.model)??(p===`session`?Q(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Q).filter(e=>e!==void 0),_=Q(u?.fallbackProfile)??Q(f.fallbackProfile),v=Q(u?.name)??Q(u?.agentId)??Q(u?.role)??Q(t.assignee)??Q(t.assignedAgent)??`Unassigned`,y=t.lifecycle?.history.at(-1),b=s.find(e=>e.note&&e.type!==`task.note.added`)?.note,x=`Placed in ${e.columns.find(e=>e.id===t.columnId)?.title??t.columnId}.`;u?.error?x=`Agent run failed: ${u.error}`:l.length?x=`Blocked by ${l.map(e=>e.title).join(`, `)}.`:y?.comment?x=y.comment:b?x=b:t.status===`review`?x=`Implementation is waiting for review evidence or approval.`:t.status===`in_progress`?x=`${v} is currently working on this task.`:t.status===`completed`&&(x=`The task and its current assignment are complete.`);let S=s.map(e=>Number(vn(e.after).attempt)).filter(e=>Number.isFinite(e)),C=s.filter(e=>e.type===`task.claimed`||e.type===`task.assigned`).length,w=s.find(e=>Qt(e)===`failures`),T=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${xn(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??w?.note,lastResult:u?.lastResult??T?.note,eventCount:s.length,lastActivity:s[0]}}function xn(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Sn(e,t){if(!e)return`—`;let n=Date.parse(e),r=t?Date.parse(t):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r))return`—`;let i=Math.max(0,Math.round((r-n)/6e4));return i<1?`<1m`:i<60?`${i}m`:`${Math.floor(i/60)}h ${i%60}m`}function $({label:e,value:t,mono:n=!1}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-2 py-1 text-[11px]`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:n?`break-all font-mono text-[10px]`:`min-w-0 break-words`,children:t})]})}function Cn({icon:e,title:t,children:n}){return(0,K.jsxs)(`section`,{className:`rounded-md border border-border/70 bg-background/55 p-2.5`,children:[(0,K.jsxs)(`h4`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[e,t]}),(0,K.jsx)(`dl`,{className:`divide-y divide-border/35`,children:n})]})}function wn({items:e}){let{t}=m();return e.length?(0,K.jsx)(`span`,{className:`space-y-1`,children:e.map(e=>(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate`,title:e.title,children:e.title}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1 py-0.5 text-[9px]`,children:e.status})]},e.id))}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t(`activity:taskIntel.none`)})}function Tn({board:e,task:t,events:n,presence:r,sessionId:i,sessionProvider:a,sessionModel:o}){let{t:s}=m(),c=bn(e,t,n,i,a,o,r),l=t.assignment,u=t.successCriteria?.length??0,p=t.successCriteria?.filter(e=>e.status===`passed`).length??0,g=[t.parentTaskId,...t.childTaskIds??[],t.chain?.previousTaskId,t.chain?.nextTaskId,t.mergedIntoTaskId,...t.mergedFromTaskIds??[]].filter(e=>!!e),_=yn(e,[...new Set(g)]);return(0,K.jsxs)(`details`,{open:!0,className:`mt-3 rounded-md border border-primary/25 bg-primary/[0.025]`,children:[(0,K.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden`,children:[(0,K.jsx)(le,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:s(`activity:taskIntel.heading`)}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:t.status}),(0,K.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:s(`activity:taskIntel.eventsCount`,{count:c.eventCount})}),(0,K.jsx)(h,{className:`size-3.5 text-muted-foreground`})]}),(0,K.jsxs)(`div`,{className:`space-y-2.5 border-t border-border/60 p-2.5`,children:[(0,K.jsxs)(`section`,{className:`rounded-md border border-info/25 bg-info/5 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[10px]`,children:[(0,K.jsx)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 font-semibold text-info`,children:c.column}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.stagePrefix`),t.lifecycle?.currentStage??s(`activity:taskIntel.legacyStage`)]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.priorityPrefix`),t.priority]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[s(`activity:taskIntel.typePrefix`),t.type??s(`activity:taskIntel.inferredType`)]})]}),(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,K.jsx)(`strong`,{children:s(`activity:taskIntel.whyHere`)}),` `,c.reason]}),c.blockers.length>0&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-warning`,children:s(`activity:taskIntel.unresolvedBlockers`,{count:c.blockers.length})})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,K.jsxs)(Cn,{icon:(0,K.jsx)(oe,{className:`size-3`}),title:s(`activity:taskIntel.ownershipRuntime`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.owner`),value:c.owner}),(0,K.jsx)($,{label:s(`activity:taskIntel.assignee`),value:Q(t.assignee)??Q(t.assignedAgent)??`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentId`),value:Q(l?.agentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.agentNameRole`),value:[Q(l?.name),Q(l?.role)].filter(Boolean).join(` · `)||`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.runStatus`),value:Q(l?.status)??`unassigned`}),(0,K.jsx)($,{label:s(`activity:taskIntel.subagent`),value:Q(l?.subagentId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.runTask`),value:Q(l?.runTaskId)??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.sessionS`),value:c.sessions.join(`, `)||`Unknown`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.usersPresence`),value:c.presence.length?c.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(j,{className:`size-3`}),title:s(`activity:taskIntel.modelRouteFallback`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.routingMode`),value:c.routingMode}),(0,K.jsx)($,{label:s(`activity:taskIntel.primary`),value:c.primaryModel,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.provider`),value:c.provider??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.model`),value:c.model??`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.fallbackRoute`),value:c.fallbackRoute,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.skills`),value:l?.skills?.map(Q).filter(Boolean).join(`, `)||`Default`}),(0,K.jsx)($,{label:s(`activity:taskIntel.tools`),value:l?.tools?.map(Q).filter(Boolean).join(`, `)||`Default toolset`}),(0,K.jsx)($,{label:s(`activity:taskIntel.capabilities`),value:l?.allowedCapabilities?.map(Q).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(E,{className:`size-3`}),title:s(`activity:taskIntel.executionPolicyOutcome`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.attempts`),value:`${c.attempts}${l?.maxAttempts?` / ${l.maxAttempts}`:``}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.retryPolicy`),value:l?.retryPolicy??t.retryPolicy??`off`}),(0,K.jsx)($,{label:s(`activity:taskIntel.costCeiling`),value:(l?.costCeilingUsd??t.costCeilingUsd)==null?`Unbounded`:`$${(l?.costCeilingUsd??t.costCeilingUsd).toFixed(2)}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.failuresDone`),value:`${c.failures} / ${c.completions}`}),(0,K.jsx)($,{label:s(`activity:taskIntel.checks`),value:`${p} / ${u} passed`}),(0,K.jsx)($,{label:s(`activity:taskIntel.lastFailure`),value:c.lastFailure??`—`}),(0,K.jsx)($,{label:s(`activity:taskIntel.result`),value:c.lastResult??`No result recorded`})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(f,{className:`size-3`}),title:s(`activity:taskIntel.timingAuditCoverage`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.created`),value:xn(t.createdAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.updated`),value:xn(t.updatedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.due`),value:xn(t.dueDate)}),(0,K.jsx)($,{label:s(`activity:taskIntel.dispatched`),value:xn(l?.dispatchedAt??l?.claimedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.completed`),value:xn(l?.completedAt??t.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.duration`),value:Sn(l?.dispatchedAt??l?.claimedAt,l?.completedAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.heartbeat`),value:xn(l?.heartbeatAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.leaseExpires`),value:xn(l?.leaseExpiresAt)}),(0,K.jsx)($,{label:s(`activity:taskIntel.actors`),value:c.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,K.jsxs)(Cn,{icon:(0,K.jsx)(d,{className:`size-3`}),title:s(`activity:taskIntel.dependenciesChainProvenance`),children:[(0,K.jsx)($,{label:s(`activity:taskIntel.dependencies`),value:(0,K.jsx)(wn,{items:c.dependencies})}),(0,K.jsx)($,{label:s(`activity:taskIntel.otherRelations`),value:(0,K.jsx)(wn,{items:_})}),(0,K.jsx)($,{label:s(`activity:taskIntel.chain`),value:t.chain?`${t.chain.chainId} · position ${t.chain.order}`:`None`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.originSystem`),value:t.origin?.system??`manual`}),(0,K.jsx)($,{label:s(`activity:taskIntel.originIds`),value:t.origin&&[t.origin.graphId,t.origin.phaseId,t.origin.taskId,t.origin.specId].filter(Boolean).join(` · `)||`—`,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.taskId`),value:t.id,mono:!0}),(0,K.jsx)($,{label:s(`activity:taskIntel.boardId`),value:e.id,mono:!0})]})]})]})}var En={passed:{icon:x,labelKey:`activity:verifyReport.verdictPassed`,className:`text-success`},failed:{icon:s,labelKey:`activity:verifyReport.verdictFailed`,className:`text-destructive`},needs_human:{icon:p,labelKey:`activity:verifyReport.verdictNeedsHuman`,className:`text-warning`},incomplete:{icon:g,labelKey:`activity:verifyReport.verdictIncomplete`,className:`text-muted-foreground`}},Dn={passed:{labelKey:`activity:verifyReport.checkPassed`,className:`text-success`},failed:{labelKey:`activity:verifyReport.checkFailed`,className:`text-destructive`},skipped:{labelKey:`activity:verifyReport.checkSkipped`,className:`text-muted-foreground`},error:{labelKey:`activity:verifyReport.checkError`,className:`text-warning`}};function On(e,t){let n=Date.parse(t)-Date.parse(e);return Number.isNaN(n)||n<0?``:n<1e3?`${n}ms`:n<6e4?`${Math.round(n/1e3)}s`:`${Math.floor(n/6e4)}m ${Math.round(n%6e4/1e3)}s`}function kn({verdict:e}){let{t}=m(),n=En[e],r=n.icon;return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-semibold ${n.className}`,children:[(0,K.jsx)(r,{size:13}),t(n.labelKey)]})}function An({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,B.useState)(n);return(0,K.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`flex w-full items-center gap-2 px-3 py-2 text-xs font-semibold uppercase text-muted-foreground hover:bg-muted/50`,children:[i?(0,K.jsx)(h,{size:13}):(0,K.jsx)(C,{size:13}),(0,K.jsx)(t,{size:13}),e]}),i&&(0,K.jsx)(`div`,{className:`border-t px-3 py-2 space-y-2`,children:r})]})}function jn({check:e}){let t=Dn[e.status],{t:n}=m(),[r,i]=(0,B.useState)(!1),a=e.error||e.backingRefs?.length;return(0,K.jsxs)(`div`,{className:`rounded border bg-muted/30 px-2.5 py-2 text-xs`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-medium ${t.className}`,children:n(t.labelKey)}),(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:e.type})]}),(0,K.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:e.description})]}),a&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(!r),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:r?(0,K.jsx)(h,{size:13}):(0,K.jsx)(C,{size:13})})]}),r&&(0,K.jsxs)(`div`,{className:`mt-2 space-y-1.5 border-t pt-2`,children:[e.error&&(0,K.jsx)(`div`,{className:`rounded bg-destructive/10 px-2 py-1 text-destructive`,children:e.error}),e.backingRefs?.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,K.jsx)(ue,{size:11}),(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.path}),(0,K.jsxs)(`span`,{className:`text-[10px]`,children:[`(`,e.kind,`)`]}),e.summary&&(0,K.jsxs)(`span`,{className:`truncate`,children:[`— `,e.summary]})]},t))]})]})}function Mn({fileScope:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`activity:verifyReport.expected`),` `,(0,K.jsx)(`strong`,{children:e.expectedChanges}),` changes`]}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[t(`activity:verifyReport.actual`),` `,(0,K.jsx)(`strong`,{children:e.actualChanges}),` changes`]}),(0,K.jsx)(`span`,{className:e.scopeMatches?`text-success`:`text-destructive`,children:e.scopeMatches?`✅ Scope matches`:`❌ Scope mismatch`})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.files.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:e.operation===`create`?`text-success`:e.operation===`delete`?`text-destructive`:`text-muted-foreground`,children:e.operation===`create`?`+`:e.operation===`delete`?`−`:`∼`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),(0,K.jsxs)(`span`,{className:`text-[10px]`,children:[e.linesChanged,` line`,e.linesChanged===1?``:`s`]}),!e.expected&&(0,K.jsx)(`span`,{className:`rounded bg-warning/10 px-1 text-[10px] text-warning`,children:`unexpected`})]},t))})]})}function Nn({subtasks:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[t(`activity:verifyReport.total`),` `,(0,K.jsx)(`strong`,{children:e.total})]}),(0,K.jsxs)(`span`,{className:`text-success`,children:[t(`activity:verifyReport.completed`),` `,(0,K.jsx)(`strong`,{children:e.completed})]}),e.failed>0&&(0,K.jsxs)(`span`,{className:`text-destructive`,children:[t(`activity:verifyReport.failed`),` `,(0,K.jsx)(`strong`,{children:e.failed})]})]}),(0,K.jsx)(`div`,{className:`space-y-1`,children:e.children.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.verdict===`passed`?(0,K.jsx)(`span`,{className:`text-success`,children:`✓`}):e.verdict===`failed`?(0,K.jsx)(`span`,{className:`text-destructive`,children:`✗`}):e.verdict===`needs_human`?(0,K.jsx)(`span`,{className:`text-warning`,children:`⚠`}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`○`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},t))})]})}function Pn({attachments:e}){return(0,K.jsx)(`div`,{className:`space-y-1`,children:e.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded border bg-muted/30 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(w,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`font-medium`,children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.path?(0,K.jsxs)(`span`,{className:`truncate block`,children:[e.path,(0,K.jsx)(`span`,{className:`ml-1 rounded bg-muted px-1 text-[10px]`,children:e.kind})]}):(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px]`,children:e.kind})}),e.content&&(0,K.jsxs)(`pre`,{className:`mt-1 max-h-20 overflow-auto rounded bg-background p-1 text-[10px] text-muted-foreground`,children:[e.content.slice(0,500),e.content.length>500?`
|
|
3
|
+
…`:``]})]})]},t))})}function Fn({report:e}){let{t}=m();return(0,K.jsxs)(`div`,{className:`mt-5 space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground`,children:t(`activity:verifyReport.verificationReport`)}),(0,K.jsx)(kn,{verdict:e.verdict})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:On(e.startedAt,e.completedAt)})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground whitespace-pre-wrap`,children:e.markdownSummary}),e.checks.length>0&&(0,K.jsx)(An,{title:t(`activity:verifyReport.checkResults`),icon:O,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,K.jsx)(jn,{check:e},e.checkId))}),e.fileScope&&(0,K.jsx)(An,{title:t(`activity:verifyReport.fileScope`),icon:ue,defaultOpen:!e.fileScope.scopeMatches,children:(0,K.jsx)(Mn,{fileScope:e.fileScope})}),e.subtasks&&(0,K.jsx)(An,{title:t(`activity:verifyReport.subTasks`),icon:O,children:(0,K.jsx)(Nn,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,K.jsx)(An,{title:`Attachments (${e.attachments.length})`,icon:w,children:(0,K.jsx)(Pn,{attachments:e.attachments})})]})}function In({boardId:e,task:t,sendKanban:n}){let{t:r}=m();return gt(t,be(n=>n.verificationActivity[`${e}:${t.id}`]))===`running`?(0,K.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-md border border-info/30 bg-info/5 p-3 text-xs text-info`,children:[(0,K.jsx)(N,{size:14,className:`animate-spin`}),r(`activity:taskVerify.verificationRunningChecksAreBeingExecuted`)]}):t.verificationReport?(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(Fn,{report:t.verificationReport}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(`kanban.task.verify`,{boardId:e,taskId:t.id}),className:`mt-1.5 rounded-md border px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted`,children:r(`activity:taskVerify.reRunVerification`)})]}):(0,K.jsxs)(`div`,{className:`mt-4 rounded-md border border-dashed p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(T,{size:14}),(0,K.jsx)(`span`,{className:`font-medium`,children:r(`activity:taskVerify.unverified`)}),(0,K.jsx)(`span`,{children:r(`activity:taskVerify.noVerificationReportExistsForThis`)})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>n(`kanban.task.verify`,{boardId:e,taskId:t.id}),className:`mt-2 rounded-md bg-primary/10 px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-primary/20`,children:r(`activity:taskVerify.runVerification`)})]})}function Ln({boards:e,board:t,task:r,runLink:i,onClose:a,onSelectTask:s,sendKanban:c,sendRaw:l,refreshBoard:u,activityEvents:d,activityPresence:f,activityLoading:p,activityError:g,activitySessionId:y,refreshActivity:b}){let{t:x}=m(),[S,C]=(0,B.useState)(``),[w,T]=(0,B.useState)(``),[D,O]=(0,B.useState)(``),[k,j]=(0,B.useState)(``),[M,te]=(0,B.useState)(``),[N,re]=(0,B.useState)(`session`),[ie,ae]=(0,B.useState)(``),[oe,se]=(0,B.useState)([]),[ce,le]=(0,B.useState)([]),[ue,de]=(0,B.useState)([]),[pe,me]=(0,B.useState)([]),[P,F]=(0,B.useState)(``),he=xe(!!r),I=Ke(!!r),ge=J(I.sessionProvider),_e=J(I.sessionModel),ve=we(`kanban-task-inspector`,!!r),[ye,be]=(0,B.useState)(!1),[R,Ce]=(0,B.useState)(!1),[Te,z]=(0,B.useState)(``),[Ee,De]=(0,B.useState)(``),[Oe,V]=(0,B.useState)(``),[ke,H]=(0,B.useState)(`pending`),[Ae,je]=(0,B.useState)(``),[Me,Ne]=(0,B.useState)(``),[Pe,Fe]=(0,B.useState)(``),[Ie,Le]=(0,B.useState)(`medium`),[Re,ze]=(0,B.useState)(`chore`),[U,Be]=(0,B.useState)(``),[W,Ve]=(0,B.useState)([]),[He,Ue]=(0,B.useState)([]),[G,We]=(0,B.useState)(!1),[Ge,qe]=(0,B.useState)(``),[Je,Ye]=(0,B.useState)(``),[Xe,Ze]=(0,B.useState)(`off`),[Qe,$e]=(0,B.useState)(``),[et,tt]=(0,B.useState)(``),[nt,rt]=(0,B.useState)(``),[it,ot]=(0,B.useState)(``),[st,ct]=(0,B.useState)(``),[lt,ut]=(0,B.useState)(`observation`),[dt,ft]=(0,B.useState)(`unknown`),[pt,ht]=(0,B.useState)(``);(0,B.useEffect)(()=>{let n=J(r?.assignment?.provider),i=J(r?.assignment?.model);C(J(r?.assignment?.agentId)??J(r?.assignedAgent)??``),T(J(r?.assignment?.name)??``),O(J(r?.assignment?.role)??``),j(n??``),te(i??``),re(r?.assignment?.modelRouting??(n||i?`fixed`:`session`)),ae(J(r?.assignment?.fallbackProfile)??``),se(r?.assignment?.fallbackModels??[]),le(r?.assignment?.skills??[]),de(r?.assignment?.tools??[]),me(r?.assignment?.allowedCapabilities??[]),F(e.find(e=>e.id!==t?.id)?.id??``),z(r?.title??``),De(r?.description??``),V(r?.dueDate??``),H(r?.status??`pending`),je(``),Ne(``),Fe(``),Le(r?.priority??`medium`),ze(r?.type??`chore`),Be(r?.labels?.join(`, `)??``),Ve(r?.dependsOn??[]),Ue(r?.chain&&t?t.tasks.filter(e=>e.chain?.chainId===r.chain?.chainId).sort((e,t)=>(e.chain?.order??0)-(t.chain?.order??0)).map(e=>e.id):r?[r.id]:[]),We(!1),qe(r?.estimatedHours?.toString()??``),Ye(r?.actualHours?.toString()??``),Ze(r?.retryPolicy??r?.assignment?.retryPolicy??`off`),$e((r?.costCeilingUsd??r?.assignment?.costCeilingUsd)?.toString()??``),tt(r?.assignment?.maxAttempts?.toString()??``),rt(``),ot(``),ct(``),ut(`observation`),ft(`unknown`),ht(``)},[t?.id,r?.id]);let gt=e=>({boardId:t?.id,taskId:r?.id,...S.trim()?{agentId:S.trim()}:{},...w.trim()?{name:w.trim()}:{},...D.trim()?{role:D.trim()}:{},modelRouting:N,...N===`fixed`&&k.trim()?{provider:k.trim()}:{},...N===`fixed`&&M.trim()?{model:M.trim()}:{},...N===`fallback_profile`&&ie.trim()?{fallbackProfile:ie.trim()}:{},fallbackModels:oe,skills:ce,tools:ue,allowedCapabilities:pe,...et?{maxAttempts:Number(et)}:{},...Qe?{costCeilingUsd:Number(Qe)}:{},retryPolicy:Xe,activityNote:pt.trim()||`${x(`activity:kanban.activityNoteTemplate`,{action:x(e===`dispatch`?`activity:kanban.dispatched`:`activity:kanban.assigned`),target:w.trim()||S.trim()||D.trim()||x(`activity:kanban.configuredAgentRoute`)})}`}),_t=()=>{!t||!r||!Te.trim()||(c(`kanban.task.update`,{boardId:t.id,taskId:r.id,title:Te.trim(),description:Ee,dueDate:Oe||null,...t.lifecycle?.mode===`managed`?{}:{status:ke},priority:Ie,type:Re,labels:U.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:W,...r.chain&&He.length<=1?{chain:null}:{},estimatedHours:Ge?Number(Ge):0,actualHours:Je?Number(Je):0,retryPolicy:Xe,costCeilingUsd:Qe?Number(Qe):null,activityNote:pt.trim()||`Task contract edited in WebUI.`}),He.length>1&&c(`kanban.task.chain`,{boardId:t.id,taskIds:He,enforceDependencies:G}),window.setTimeout(()=>u(t.id),180),ht(``))},vt=[`backlog`,`todo`,`running`,`review`,`done`],yt=r?.lifecycle?.currentStage,bt=yt?vt.indexOf(yt):-1,wt=bt>=0&&bt<vt.length-1?vt[bt+1]:void 0;return r?(0,K.jsxs)(`aside`,{"aria-label":x(`activity:kanban.taskInspector`),"data-expanded":R?`true`:`false`,className:L(`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`,R?`fixed inset-0 z-50 h-dvh max-h-none w-screen border-0 bg-card transition-none md:w-screen md:border-0`:`md:w-[420px] xl:w-[480px]`),children:[(0,K.jsxs)(`div`,{className:L(`flex h-12 items-center gap-2 border-b px-3`,R&&`px-5`),children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:x(`activity:kanban.task`)}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:r.id.slice(0,8)})]}),(0,K.jsx)(`button`,{type:`button`,title:x(R?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-label":x(R?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-pressed":R,onClick:()=>Ce(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:R?(0,K.jsx)(o,{size:16}):(0,K.jsx)(ee,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:x(`common:action.close`),onClick:()=>{Ce(!1),a()},className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(A,{size:16})})]}),r?(0,K.jsxs)(`div`,{ref:ve,className:L(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,R&&`px-5 py-4 xl:px-7`),children:[(0,K.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,K.jsx)(at,{title:x(`activity:kanban.taskBoundary`),value:r.boundary,inherited:t?.boundary,onSave:e=>{t&&(c(`kanban.task.update`,{boardId:t.id,taskId:r.id,boundary:e,activityNote:`Task boundary edited in WebUI.`}),window.setTimeout(()=>u(t.id),150))}}),(0,K.jsx)(Y,{label:x(`activity:kanban.title`),value:Te,onChange:z}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.descriptionWorkingContext`)}),(0,K.jsx)(`textarea`,{value:Ee,onChange:e=>De(e.target.value),rows:5,className:`w-full resize-y rounded-md border bg-background px-2 py-1.5 text-xs leading-5 outline-none focus:border-primary`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[t?.lifecycle?.mode===`managed`?(0,K.jsxs)(`div`,{className:`rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:x(`activity:kanban.managedStage`)}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:r.lifecycle?.currentStage??`Backlog`})]}):(0,K.jsx)(Ct,{label:x(`activity:kanban.status`),value:ke,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>H(e)}),(0,K.jsx)(Ct,{label:x(`activity:kanban.priority`),value:Ie,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Le(e)}),(0,K.jsx)(Ct,{label:x(`activity:kanban.type`),value:Re,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>ze(e)}),(0,K.jsx)(Y,{label:x(`activity:kanban.labelsCommaSeparated`),value:U,onChange:Be})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(Y,{label:x(`activity:kanban.dueDatePlaceholder`),value:Oe,onChange:V}),(0,K.jsx)(Y,{label:x(`activity:kanban.estimatedHours`),value:Ge,onChange:qe}),(0,K.jsx)(Y,{label:x(`activity:kanban.actualHours`),value:Je,onChange:Ye})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.dependencies`)}),(0,K.jsx)(q,{options:(t?.tasks??[]).filter(e=>e.id!==r.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:W,onChange:Ve,placeholder:x(`activity:kanban.selectBlockingTasks`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.taskChainSelectionOrder`)}),(0,K.jsx)(q,{options:(t?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:He,onChange:e=>Ue(e.includes(r.id)?e:[r.id,...e]),placeholder:x(`activity:kanban.selectSequentialChain`)}),(0,K.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>We(e.target.checked)}),x(`activity:kanban.enforceChainOrder`)]})]}),(0,K.jsx)(Y,{label:x(`activity:kanban.assignmentReason`),value:pt,onChange:ht}),(0,K.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,K.jsx)(fe,{size:15}),` `,x(`activity:kanbanInspector.saveTaskContract`)]}),t?.lifecycle?.mode===`managed`&&wt&&(0,K.jsxs)(`section`,{"aria-label":x(`activity:kanban.managedLifecycle`),className:`space-y-2 rounded-md border border-primary/30 bg-primary/5 p-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-primary`,children:x(`activity:kanban.kanbanAgentTransition`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[yt,` → `,wt,`; no stages can be skipped.`]})]}),(0,K.jsx)(E,{size:16,className:`text-primary`})]}),(0,K.jsx)(Y,{label:x(`activity:kanban.completedAction`),value:Me,onChange:Ne}),(0,K.jsx)(Y,{label:x(`activity:kanban.progressComment`),value:Ae,onChange:je}),(0,K.jsx)(Y,{label:x(`activity:kanban.evidenceUrl`),value:Pe,onChange:Fe}),(0,K.jsxs)(`button`,{type:`button`,disabled:!Ae.trim(),onClick:()=>{!t||!r||!wt||!Ae.trim()||(c(`kanban.task.transition`,{boardId:t.id,taskId:r.id,to:wt,actor:S.trim()||w.trim()||r.assignee||r.assignedAgent||`webui-agent`,comment:Ae.trim(),...Me.trim()?{action:Me.trim()}:{},...Pe.trim()?{attachment:{url:Pe.trim(),type:`url`,title:`Evidence for ${r.title}`}}:{}}),window.setTimeout(()=>u(t.id),180))},className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(n,{size:15}),` Advance to `,wt]})]})]}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Tn,{board:t,task:r,events:d,presence:f,sessionId:y,sessionProvider:ge,sessionModel:_e}),(0,K.jsx)(_n,{task:r,events:d,sessionId:y}),(0,K.jsx)(At,{board:t,task:r,events:d})]}),(0,K.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,K.jsx)(St,{label:x(`activity:kanban.source`),value:r.origin?.system??`manual`}),(0,K.jsx)(St,{label:x(`activity:kanban.taskId`),value:r.id.slice(0,8)}),(0,K.jsx)(St,{label:x(`activity:kanban.run`),value:r.assignment?.status??`unassigned`}),(0,K.jsx)(St,{label:x(`activity:kanban.column`),value:xt(t,r.columnId)})]}),r.assignment&&(0,K.jsx)(Gt,{assignment:r.assignment}),i&&r.origin?.taskId&&(0,K.jsx)(It,{runLink:i,runTaskId:r.origin.taskId,modelCandidates:he,sendRaw:l}),!i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.jsx)(Ct,{label:x(`activity:kanban.primaryModelSource`),value:N,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>re(e)}),N===`session`&&(0,K.jsxs)(`div`,{className:`rounded-md border bg-info/5 px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Uses the live session model: `,ge?`${ge}/`:``,_e||`not available`,`.`]}),N===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanbanInspector.fixedProviderModel`)}),(0,K.jsx)(Se,{value:M||void 0,provider:k||void 0,candidates:he,placeholder:x(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{te(e),j(t)}})]}),N===`fallback_profile`&&(0,K.jsx)(Ct,{label:x(`activity:kanban.fallbackProfile`),value:ie,options:Object.keys(I.fallbackProfiles),placeholder:x(`activity:kanban.selectProfile`),onChange:ae}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanban.fallbackModels`)}),(0,K.jsx)(q,{options:he.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:oe,onChange:se,placeholder:x(`activity:kanban.addFallbackModel`),emptyLabel:`No models — add a provider in Settings`})]}),(0,K.jsx)(Ct,{label:x(`activity:kanban.role`),value:D,options:Jt,placeholder:x(`activity:kanban.selectRole`),onChange:O}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Agentic skills`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.forceLoadedIntoTheWorker`)})]}),(0,K.jsx)(q,{options:I.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:ce,onChange:le,placeholder:x(`activity:kanban.assignSkills`),emptyLabel:`No skills registered`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Tools`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.blankFullDefaultToolset`)})]}),(0,K.jsx)(q,{options:I.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:ue,onChange:de,placeholder:x(`activity:kanban.restrictTools`),emptyLabel:`Tool list unavailable on this server`})]}),(0,K.jsxs)(`div`,{className:`rounded-md border bg-background/60`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>be(e=>!e),className:`flex w-full items-center justify-between px-2 py-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[x(`activity:kanbanInspector.advanced`),(0,K.jsx)(h,{size:13,className:L(`transition-transform`,ye&&`rotate-180`)})]}),ye&&(0,K.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,K.jsx)(Y,{label:x(`activity:kanban.agentNameOptional`),value:w,onChange:T}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(Ct,{label:x(`activity:kanban.retryPolicy`),value:Xe,options:[`off`,`incremental`,`exponential`],onChange:e=>Ze(e)}),(0,K.jsx)(Y,{label:x(`activity:kanban.maxAttempts`),value:et,onChange:tt}),(0,K.jsx)(Y,{label:x(`activity:kanban.costCeilingUsd`),value:Qe,onChange:$e})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:[`Capabilities`,` `,(0,K.jsx)(`span`,{className:`text-muted-foreground/70`,children:x(`activity:kanbanInspector.blankSafeDefaults`)})]}),(0,K.jsx)(q,{options:Yt,selected:pe,onChange:me,placeholder:x(`activity:kanban.grantCapability`)})]})]})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||(c(`kanban.task.assign`,gt(`assign`)),ht(``),window.setTimeout(()=>u(t.id),150))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,K.jsx)(v,{size:15}),x(`activity:kanbanInspector.assign`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||(c(`kanban.task.dispatch`,gt(`dispatch`)),ht(``),window.setTimeout(()=>u(t.id),200))},className:`inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90`,children:[(0,K.jsx)(ne,{size:15}),x(`activity:kanbanInspector.dispatch`)]})]})]}),e.length>1&&!i?(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 rounded-md border bg-background p-2`,children:[(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:x(`activity:kanban.targetBoard`)}),(0,K.jsx)(`select`,{value:P,onChange:e=>F(e.target.value),className:`h-8 w-full rounded-md border bg-background px-2 text-sm outline-none focus:border-primary`,children:e.filter(e=>e.id!==t?.id).map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||!P||c(`kanban.task.copy`,{boardId:t.id,taskId:r.id,targetBoardId:P})},disabled:!P,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(_,{size:15}),x(`activity:kanbanInspector.copy`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{!t||!r||!P||c(`kanban.task.transfer`,{boardId:t.id,taskId:r.id,targetBoardId:P})},disabled:!P,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(n,{size:15}),x(`activity:kanbanInspector.transfer`)]})]})]}):null,(0,K.jsx)(qt,{board:t,task:r,newCheck:nt,onNewCheckChange:rt,onAddCheck:()=>{!t||!r||!nt.trim()||(c(`kanban.task.check.add`,{boardId:t.id,taskId:r.id,description:nt.trim(),checkType:`manual`}),rt(``))},sendKanban:c}),t&&(0,K.jsx)(In,{boardId:t.id,task:r,sendKanban:c}),t&&(0,K.jsx)(mt,{board:t,task:r,sendKanban:c,onSelectTask:s}),(0,K.jsx)(cn,{task:r,events:d,sessionId:y,loading:p,error:g,onRefresh:b}),(0,K.jsx)(Kt,{activityKind:lt,activityOutcome:dt,note:it,details:st,onActivityKindChange:ut,onActivityOutcomeChange:ft,onNoteChange:ot,onDetailsChange:ct,onRecordActivity:()=>{!t||!r||!it.trim()||(c(`kanban.task.activity.add`,{boardId:t.id,taskId:r.id,kind:lt,outcome:dt,summary:it.trim(),...st.trim()?{details:st.trim()}:{},actor:w.trim()||S.trim()||`webui-operator`}),ot(``),ct(``),window.setTimeout(b,150))}})]}):null]}):null}var Rn=[[`board`,`Board`],[`tree`,`Tree`],[`dashboard`,`Verification`]];function zn({viewMode:e,onViewModeChange:t}){return(0,K.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b px-4 py-1.5`,children:Rn.map(([n,r])=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:L(`rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors`,e===n?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted`),children:r},n))})}function Bn(){let[e,t]=(0,B.useState)([]);return(0,B.useEffect)(()=>{let e=!1,n=async()=>{try{let n=await fetch(`/api/sessions`);if(!n.ok)return;let r=await n.json();if(!Array.isArray(r)||e)return;let i=r.filter(e=>!!e&&typeof e==`object`&&typeof e.sessionId==`string`&&e.status!==`lost`).map(e=>e.sessionId).sort();t(e=>e.length===i.length&&e.every((e,t)=>e===i[t])?e:i)}catch{}};n();let r=window.setInterval(n,8e3);return()=>{e=!0,window.clearInterval(r)}},[]),e}var Vn=5e3,Hn=12;function Un({onClose:e}){let{t}=m(),n=_e(e=>e.wsUrl),r=ge(e=>e.session?.id??null),a=ve(e=>e.agents),{boards:o,boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoard:d,loading:f,error:p,queueHealth:h,supervisorSnapshot:g,setLoading:v,setActiveBoardId:b}=be(),[x,S]=(0,B.useState)(``),[C,w]=(0,B.useState)(1),T=Bn(),[ee,E]=(0,B.useState)(``),D=(0,B.useRef)(null);De(D);let[O,k]=(0,B.useState)(``),[j,M]=(0,B.useState)(null),[te,ne]=(0,B.useState)([]),[N,re]=(0,B.useState)(),[ae,oe]=(0,B.useState)(!1),[se,ce]=(0,B.useState)(null),[le,ue]=(0,B.useState)(0),[de,fe]=(0,B.useState)(null),[pe,me]=(0,B.useState)(`board`),P=(0,B.useRef)(null),F=(0,B.useMemo)(()=>I(n),[n]),he=d?.tasks.find(e=>e.id===j)??null,L=(0,B.useMemo)(()=>Qe(a.values()),[a]),R=(0,B.useRef)([]),xe=(0,B.useMemo)(()=>{let e=$e({sessionId:r,registrySessionIds:T,agents:a.values()}),t=R.current;return t.length===e.length&&t.every((t,n)=>t===e[n])?t:(R.current=e,e)},[a,T,r]),Se=o.filter(e=>ye(e,xe)),Ce=o.filter(e=>!ye(e,xe)),we=(0,B.useMemo)(()=>d?ke(d,{now:Date.now(),liveAgentIdentities:L,requireDueDate:d.lifecycle?.mode===`managed`}):null,[d,L]),Te=(0,B.useMemo)(()=>et(d),[d]),z=(e,t={})=>{v(!0),F.send({type:e,payload:t})},Ee=(e,t={})=>{F.send({type:e,payload:t})},Oe=(0,B.useMemo)(()=>tt(d),[d]),V=(e=C)=>z(`kanban.list`,{page:e,pageSize:Hn,activeSessionIds:xe}),H=(e=u)=>{e&&z(`kanban.get`,{boardId:e})};(0,B.useEffect)(()=>{V()},[]),(0,B.useEffect)(()=>{let e=r?o.find(e=>e.tags?.includes(`session:${r}`)):void 0,t=!!(r&&e)&&P.current!==r,n=t?e:u?void 0:o[0];n?.id&&(t&&(P.current=r),b(n.id),z(`kanban.get`,{boardId:n.id}))},[o,u,r,b]),(0,B.useEffect)(()=>{d&&j&&!d.tasks.some(e=>e.id===j)&&M(null)},[d,j]),(0,B.useEffect)(()=>{u&&(z(`kanban.health`,{boardId:u}),z(`kanban.supervisor.status`,{boardId:u}))},[u]),(0,B.useEffect)(()=>{if(!u)return;let e=setInterval(()=>{F.send({type:`kanban.get`,payload:{boardId:u}}),F.send({type:`kanban.health`,payload:{boardId:u}})},5e3);return()=>clearInterval(e)},[u,F]),(0,B.useEffect)(()=>{let e=setInterval(()=>{F.send({type:`kanban.list`,payload:{page:C,pageSize:Hn,activeSessionIds:xe}})},8e3);return()=>clearInterval(e)},[xe,C,F]);let Ae=e=>{w(e),b(null),V(e)};(0,B.useEffect)(()=>{re(void 0)},[u,j]),(0,B.useEffect)(()=>{if(!u||!j)return;let e=u,t=j;oe(!0),ce(null);let n=F.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){ce(r.error??`Task activity could not be loaded.`),oe(!1);return}r.data?.boardId!==e||r.data.taskId!==t||(ne(r.data.events??[]),re(r.data.presence??[]),oe(!1))});return F.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Vn}}),n},[u,j,he?.updatedAt,le,F]),(0,B.useEffect)(()=>{if(!(!u||!j))return F.on.bind(F)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===u&&t.taskId===j&&ue(e=>e+1)})},[u,j,F]);let je=()=>{let e=x.trim();e&&(S(``),z(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Me=()=>{if(!d)return;let e=ee.trim();e&&(E(``),z(`kanban.task.add`,{boardId:d.id,title:e,columnId:d.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}),window.setTimeout(()=>H(d.id),150))},Ne=()=>{if(!d)return;let e=O.trim();e&&(k(``),z(`kanban.column.add`,{boardId:d.id,title:e}),window.setTimeout(()=>H(d.id),150))},Pe=()=>{d&&(z(`kanban.delete`,{boardId:d.id}),window.setTimeout(V,150))},Fe=()=>{d&&(z(`kanban.duplicate`,{boardId:d.id,title:`${d.title} Copy`}),window.setTimeout(V,150))},Ie=e=>{d&&(z(`kanban.task.remove`,{boardId:d.id,taskId:e.id}),window.setTimeout(()=>H(d.id),150))},Le=(e,t)=>{if(!d)return;let n=d.tasks.find(t=>t.id===e),r=d.columns.find(e=>e.id===n?.columnId)?.title,i=d.columns.find(e=>e.id===t)?.title??t;z(`kanban.task.move`,{boardId:d.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`}),window.setTimeout(()=>H(d.id),150)};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,K.jsx)(nt,{boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoards:Se,orphanedBoards:Ce,boardPage:C,boardPageSize:Hn,loading:f,newBoardTitle:x,onClose:e,onRefresh:()=>V(),onNewBoardTitleChange:S,onCreateBoard:je,onBoardSelect:e=>{b(e),z(`kanban.get`,{boardId:e})},onBoardPageChange:Ae}),(0,K.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`header`,{className:`flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4`,children:[(0,K.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:d?.title??`No board selected`}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:d?`${d.columns.length} columns / ${d.tasks.length} tasks`:`Create or select a board`})]}),d&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{value:ee,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Me()},placeholder:t(`activity:kanban.newTask`),className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-56`}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.addTask`),onClick:Me,className:`flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90`,children:(0,K.jsx)(i,{size:16})}),(0,K.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ne()},placeholder:t(`activity:kanban.newColumn`),className:`h-8 w-[calc(100%-2.5rem)] min-w-0 flex-none rounded-md border bg-background px-2 text-sm outline-none focus:border-primary sm:w-44`}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.addColumn`),onClick:Ne,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex`,children:(0,K.jsx)(y,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.duplicateBoard`),onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(_,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.deleteBoard`),onClick:Pe,className:`hidden h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-destructive/10 hover:text-destructive sm:flex`,children:(0,K.jsx)(ie,{size:16})})]})]}),d&&(0,K.jsx)(Ye,{presence:d.presence}),d&&(0,K.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,K.jsx)(at,{title:t(`activity:kanban.boardBoundary`),value:d.boundary,onSave:e=>{z(`kanban.update`,{boardId:d.id,boundary:e}),window.setTimeout(()=>H(d.id),150)}})}),d&&Oe&&(0,K.jsx)(Pt,{runLink:Oe,sendRaw:Ee}),d&&!Oe&&d.tasks.length>0&&(0,K.jsx)(Ft,{boardId:d.id,sendKanban:z}),d&&(0,K.jsx)(Xe,{board:d,snapshot:g,sendKanban:z}),we&&(0,K.jsx)(lt,{audit:we,onSelectTask:M}),d&&(0,K.jsx)(dt,{board:d,sendKanban:z,onSelectTask:M}),d&&(0,K.jsx)(zn,{viewMode:pe,onViewModeChange:me}),p&&(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-destructive/30 bg-destructive/10 px-4 text-sm text-destructive`,children:[(0,K.jsx)(A,{size:15}),(0,K.jsx)(`span`,{className:`truncate`,children:p})]}),(0,K.jsx)(`div`,{ref:D,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:d?(0,K.jsxs)(K.Fragment,{children:[h&&(0,K.jsx)(Nt,{queueHealth:h,runningCostTotal:Te}),pe===`tree`?(0,K.jsx)(zt,{board:d,selectedTaskId:j,onSelectTask:M}):pe===`dashboard`?(0,K.jsx)(Ht,{board:d,onSelectTask:M}):(0,K.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...d.columns].sort((e,t)=>e.order-t.order).map(e=>(0,K.jsx)(Mt,{board:d,column:e,selectedTaskId:j,dragTaskId:de,setDragTaskId:fe,onSelectTask:M,onDeleteTask:Ie,onMoveTask:Le},e.id))})]}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:t(`activity:kanban.noBoardSelected`)})})]}),(0,K.jsx)(Ln,{boards:o,board:d,task:he,runLink:Oe,onClose:()=>M(null),onSelectTask:M,sendKanban:z,sendRaw:Ee,refreshBoard:H,activityEvents:te,activityPresence:N,activityLoading:ae,activityError:se,activitySessionId:d?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>ue(e=>e+1)},he?.id??`none`)]})}export{Un as KanbanView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ar as n,Fi as r,Ft as i,La as a,Pa as o,Qn as s,Wi as c,Xr as l,_n as u,an as d,dt as f,in as p,lt as m,nr as h,pa as g,pn as _,qn as v,xa as y,xt as b,za as x,zi as S}from"./vendor-BuarzSSb.js";import"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ar as n,Fi as r,Ft as i,La as a,Pa as o,Qn as s,Wi as c,Xr as l,_n as u,an as d,dt as f,in as p,lt as m,nr as h,pa as g,pn as _,qn as v,xa as y,xt as b,za as x,zi as S}from"./vendor-BuarzSSb.js";import"./i18n-COgumVF5.js";import{t as C}from"./utils-B-9lSDIn.js";import{t as w}from"./mailbox-store-C1mzoSqJ.js";import{n as T}from"./ui-store-CE4-TlwB.js";import{o as E}from"./view-navigation-DIDEcp4V.js";import{g as D,u as O}from"./index-CtpViiZy.js";import{t as k}from"./empty-state-RRSqQaCk.js";var A=e(x(),1),j=m(),M={note:l,ask:S,assign:p,steer:_,btw:g,broadcast:p,status:r,result:c,review:d},N={high:`border-destructive/25 bg-destructive/10 text-destructive`,normal:`border-border bg-muted text-muted-foreground`,low:`border-primary/20 bg-primary/10 text-primary`};function P(e){return new Date(e).toLocaleString()}function F(e){let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?a.t(`common:time.justNow`):n<36e5?a.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?a.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?a.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t}=o(),n=Object.entries(e);return n.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:t(`activity:mailbox.readBy`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:n.map(([e,t])=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-success/10 text-success`,title:P(t),children:[(0,j.jsx)(c,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:r}=o(),a=T(e=>e.selectedMailMessage),l=T(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{l(null)},[l]);function d(){l(null),E(`chat`)}if(!a)return(0,j.jsx)(k,{icon:(0,j.jsx)(s,{className:`h-6 w-6`}),title:r(`activity:mailbox.emptyDetail`),description:r(`activity:mailbox.emptyDetailHint`)});let p=M[a.type]??v,m=r(`activity:mailbox.type.${a.type}`,{defaultValue:a.type}),g=N[a.priority]??N.normal,_=a.scope?{scope:a.scope,recipientSessionId:a.recipientSessionId}:w(a.to),x=a.to===`*`||a.to===`all`?r(`activity:mailbox.everyone`):a.to,S=_.scope===`session`?r(`activity:mailbox.sessionScope`,{sid:_.recipientSessionId??``}):_.scope===`project`?r(`activity:mailbox.projectScope`):r(`activity:mailbox.directScope`);return(0,j.jsx)(`div`,{className:C(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/70 px-3 py-3 sm:px-4 shrink-0`,children:[(0,j.jsx)(`button`,{type:`button`,onClick:d,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.backToChat`),children:(0,j.jsx)(y,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className:C(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,a.completed?`bg-success/10`:`bg-primary/10`),children:(0,j.jsx)(p,{className:C(`h-4 w-4`,a.completed?`text-success`:`text-primary`)})}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,j.jsx)(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:a.subject}),a.completed&&(0,j.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-md border border-success/25 bg-success/8 px-1.5 py-0.5 text-[10px] font-semibold text-success`,children:[(0,j.jsx)(c,{className:`h-3 w-3`}),r(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:C(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:a.priority||`normal`}),a.audience===`leaders`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-primary/25 bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[(0,j.jsx)(h,{className:`h-2.5 w-2.5`}),` `,r(`activity:mailbox.audienceLeaders`)]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground/80`,children:a.from}),(0,j.jsx)(`span`,{children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:x}),_.scope===`session`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-warning/12 text-warning`,title:r(`activity:mailbox.sessionScopeTitle`,{sid:_.recipientSessionId??``}),children:[(0,j.jsx)(h,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.sessionLabel`)]}),_.scope===`project`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-primary/12 text-primary`,children:[(0,j.jsx)(n,{className:`h-2.5 w-2.5`}),r(`activity:mailbox.projectLabel`)]}),(0,j.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(t,{className:`h-3 w-3`}),F(a.timestamp)]})]})]}),(0,j.jsx)(`button`,{type:`button`,onClick:d,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:r(`activity:mailbox.closeTitle`),children:(0,j.jsx)(f,{className:`h-4 w-4`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,j.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-5`,children:(0,j.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,j.jsx)(O,{components:D,children:a.body})})})}),(0,j.jsxs)(`div`,{className:`border-t border-border/70 bg-muted/20 px-4 py-3 shrink-0`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-2 text-xs`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(i,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:m})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:C(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,g),children:a.priority||`normal`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(b,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,title:a.from,children:a.from})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[_.scope===`session`?(0,j.jsx)(h,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(n,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:r(`activity:mailbox.scopeLabel`)}),(0,j.jsx)(`span`,{className:`truncate`,children:S})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(t,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:P(a.timestamp)})]}),a.replyTo&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(u,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:r(`activity:mailbox.replyTo`,{id:a.replyTo})})]}),a.completed&&a.completedBy&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(c,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:a.completedAt?r(`activity:mailbox.completedByAt`,{name:a.completedBy,time:P(a.completedAt)}):r(`activity:mailbox.completedBy`,{name:a.completedBy})})]}),a.outcome&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.outcome`)}),(0,j.jsx)(`span`,{children:a.outcome})]}),a.taskContext&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:r(`activity:mailbox.task`)}),(0,j.jsx)(`span`,{children:a.taskContext})]})]}),Object.keys(a.readBy??{}).length>0&&(0,j.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,j.jsx)(I,{readBy:a.readBy})})]})]})})}export{L as MailboxDetailView};
|