@wrongstack/webui 0.313.1 → 0.316.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AgentRosterView-CESYPVXA.js +9 -0
- package/dist/assets/AnalyticsDashboard-zDBIqTxO.js +1 -0
- package/dist/assets/AudienceMemoryPanel-BnNJ0EhQ.js +3 -0
- package/dist/assets/ChangesView-CGwCocSR.js +1 -0
- package/dist/assets/ChimeraReviewsView-CFxZwJBI.js +1 -0
- package/dist/assets/ChronicleDashboard-DKiMK5nl.js +1 -0
- package/dist/assets/CodeEditor-CZcMPNTH.js +2 -0
- package/dist/assets/CodeMap-zPUlmh5G.js +1 -0
- package/dist/assets/ConfirmModal-CUGk-0lT.js +1 -0
- package/dist/assets/{CronJobsPanel-BzH_InFe.js → CronJobsPanel-C_wutCVP.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-Dj-5SAEE.js → DeadCodeScanPanel-DCCjg17Q.js} +2 -2
- package/dist/assets/{DebugDashboard-C-lpnxsJ.js → DebugDashboard-D-ogYAbO.js} +1 -1
- package/dist/assets/DesignGalleryView-CtlHZWOn.js +1 -0
- package/dist/assets/GoalView-Czksj2nD.js +1 -0
- package/dist/assets/KanbanView-C5_GD0qk.js +3 -0
- package/dist/assets/MailboxDetailView-2rWp3cTv.js +1 -0
- package/dist/assets/MemoryDrawer-D9Chtt6v.js +1 -0
- package/dist/assets/MemoryManager-Bj41s3KW.js +1 -0
- package/dist/assets/ModelPicker-vwrqLOL4.js +1 -0
- package/dist/assets/OfficeMapPanel-BfuePIGH.js +4 -0
- package/dist/assets/ProcessMonitor-CHPTCtyu.js +1 -0
- package/dist/assets/PromptJournalView-tOTjKpi8.js +1 -0
- package/dist/assets/QueuePanel-BIwoG-tG.js +1 -0
- package/dist/assets/RefreshDebugView-DesPEAAq.js +1 -0
- package/dist/assets/RequirementIntakeView-BonXC1a5.js +1 -0
- package/dist/assets/SageTabs-82lpgRh-.js +2 -0
- package/dist/assets/SddFlowGraph-CMedulJi.js +1 -0
- package/dist/assets/SddHub-D3Gm4Io2.js +2 -0
- package/dist/assets/SessionInspectView-BUs2B4mF.js +1 -0
- package/dist/assets/SessionList-DxQgJqgl.js +1 -0
- package/dist/assets/SessionsDashboard-JtwQf-N5.js +1 -0
- package/dist/assets/SetupScreen-XFBFjPbd.js +1 -0
- package/dist/assets/SkillDetailView-C_P_-783.js +3 -0
- package/dist/assets/{SpecsView-B9Aj1qpe.js → SpecsView-D6GqoZ2L.js} +1 -1
- package/dist/assets/TechStackView-BE4tdEYZ.js +2 -0
- package/dist/assets/TerminalPanel-BcizpYrZ.js +1 -0
- package/dist/assets/activity-B2_Vr2oD.js +10 -0
- package/dist/assets/activity-BF1idM4Y.js +10 -0
- package/dist/assets/activity-C-kOJZXC.js +10 -0
- package/dist/assets/activity-DPpMW8BU.js +10 -0
- package/dist/assets/activity-DYMBKGt0.js +10 -0
- package/dist/assets/activity-IxgYWPDt.js +10 -0
- package/dist/assets/activity-q85HXQNv.js +10 -0
- package/dist/assets/{button-Dhmop_yM.js → button-C_EYpeP-.js} +1 -1
- package/dist/assets/{chat-CR2B97dj.js → chat-B5a3cvps.js} +1 -1
- package/dist/assets/{chat-DResBrkV.js → chat-B60h8Cji.js} +1 -1
- package/dist/assets/{chat-BnkVCZ3Q.js → chat-BNWqeV-N.js} +1 -1
- package/dist/assets/chat-BlllxfpP.js +1 -0
- package/dist/assets/{chat-BfQBSiII.js → chat-BvKkSd09.js} +1 -1
- package/dist/assets/{chat-BPuAsrkF.js → chat-DTI7lNDx.js} +1 -1
- package/dist/assets/{chat-Di8o0wDz.js → chat-DlhXGxxi.js} +1 -1
- package/dist/assets/chat-store-x5w4ss_D.js +1 -0
- package/dist/assets/{codemap-activity-store-BWt_a7Gs.js → codemap-activity-store-ZCXcHlwd.js} +1 -1
- package/dist/assets/codemap-index-store-Cb5mn74P.js +1 -0
- package/dist/assets/{dialog-DPl7DolS.js → dialog-9eW9sG90.js} +1 -1
- package/dist/assets/{empty-state-IT10GzRA.js → empty-state-DJb_tw7Q.js} +1 -1
- package/dist/assets/i18n-DkMSw3tI.js +2 -0
- package/dist/assets/index-BSpLtv9S.css +1 -0
- package/dist/assets/index-CTyM4bm8.js +137 -0
- package/dist/assets/{input-C3rIQ26u.js → input-CsEvo8Oo.js} +1 -1
- package/dist/assets/{mailbox-store-DhAVkVJQ.js → mailbox-store-KHcrg_Fm.js} +1 -1
- package/dist/assets/{roster-ws-Ch6O90eT.js → roster-ws-CXnrEaEu.js} +1 -1
- package/dist/assets/settings-1o1gooaL.js +1 -0
- package/dist/assets/settings-BGvRM3vJ.js +1 -0
- package/dist/assets/{settings-BV1_j8_-.js → settings-BV8EFmpH.js} +1 -1
- package/dist/assets/settings-Ci_RMpCQ.js +1 -0
- package/dist/assets/settings-Cy_xp4Jt.js +1 -0
- package/dist/assets/settings-D-LlBmzO.js +1 -0
- package/dist/assets/settings-nWMBX3xS.js +1 -0
- package/dist/assets/{shared-BUXBOqyO.js → shared-sYlGVRJI.js} +1 -1
- package/dist/assets/stores-5ynEAenb.js +7 -0
- package/dist/assets/toasts-BsmyGP95.js +1 -0
- package/dist/assets/toasts-CgXHu8ZB.js +1 -0
- package/dist/assets/toasts-DZ6HdKgG.js +1 -0
- package/dist/assets/toasts-DizCJjAR.js +1 -0
- package/dist/assets/toasts-NC2MT4uN.js +1 -0
- package/dist/assets/toasts-bPl097de.js +1 -0
- package/dist/assets/toasts-tCVo15mP.js +1 -0
- package/dist/assets/ui-store-9b7zzi3V.js +1 -0
- package/dist/assets/useWebSocket-1kxFH7f8.js +27 -0
- package/dist/assets/utils-DIo8iytt.js +1 -0
- package/dist/assets/{vector-memory-panel-CBA4CK6N.js → vector-memory-panel-Dd3jXXYA.js} +1 -1
- package/dist/assets/{vendor-DZ9_OO6N.js → vendor-UFryhfbN.js} +30 -30
- package/dist/assets/view-navigation-ICwpL9qw.js +1 -0
- package/dist/assets/ws-client-Ccf_VLRQ.js +22 -0
- package/dist/components/AgentOfficeView/model.d.ts +4 -3
- package/dist/components/AgentRosterView.d.ts +8 -1
- package/dist/components/ChatInput/composer-button-bar.d.ts +6 -2
- package/dist/components/ChatInput/image-attachments.d.ts +2 -1
- package/dist/components/ChatInput/next-steps-helpers.d.ts +0 -16
- package/dist/components/ChatInput/refine-panel-host.d.ts +2 -2
- package/dist/components/ChatInput/session-effort-select.d.ts +16 -0
- package/dist/components/ChatInput/slash-commands.d.ts +2 -1
- package/dist/components/ChatInput/slash-routing.d.ts +8 -0
- package/dist/components/ChatInput/use-chat-input-mcp.d.ts +2 -1
- package/dist/components/ChatInput/use-paste-drop.d.ts +2 -1
- package/dist/components/ChatInput/use-refine-timeout.d.ts +2 -1
- package/dist/components/ChatInput/use-speech-recognition.d.ts +9 -0
- package/dist/components/ChatView/AgentTabs.d.ts +1 -1
- package/dist/components/ChatView/BrainDecisionCard.d.ts +9 -0
- package/dist/components/ChatView/ChatHeader.d.ts +3 -3
- package/dist/components/ChatView/ChatRowView.d.ts +3 -1
- package/dist/components/ChatView/ChimeraReportCard.d.ts +22 -0
- package/dist/components/ChatView/CouncilDecisionCard.d.ts +9 -0
- package/dist/components/ChatView/auto-collapse.d.ts +2 -1
- package/dist/components/ChatView/useChatViewState.d.ts +14 -28
- package/dist/components/ChatView/utils.d.ts +2 -1
- package/dist/components/ChimeraReviewsView.d.ts +2 -0
- package/dist/components/CodeMapActivityStreamPanel.d.ts +2 -1
- package/dist/components/CodeMapDirectoryTree.d.ts +2 -1
- package/dist/components/CodeMapLiveOverlay.d.ts +0 -3
- package/dist/components/CodeMapSelectedNodeSummary.d.ts +2 -1
- package/dist/components/CollabPanel.d.ts +2 -7
- package/dist/components/ConfirmModal.d.ts +6 -13
- package/dist/components/CronJobsPanel.d.ts +2 -1
- package/dist/components/CustomRosterPanel.d.ts +0 -1
- package/dist/components/DependencyGraph.d.ts +2 -1
- package/dist/components/FileActivityDrawer.d.ts +2 -2
- package/dist/components/FileExplorer/FileExplorerModals.d.ts +11 -6
- package/dist/components/FileExplorer/TreeRow.d.ts +2 -6
- package/dist/components/FileExplorer/tree-helpers.d.ts +7 -0
- package/dist/components/FleetPanel.d.ts +4 -13
- package/dist/components/InspectorPanel.d.ts +6 -1
- package/dist/components/KanbanBoardSidebar.d.ts +2 -1
- package/dist/components/KanbanBoardState.d.ts +1 -1
- package/dist/components/KanbanContractGraphView.d.ts +3 -2
- package/dist/components/KanbanQueueHealthBar.d.ts +2 -1
- package/dist/components/KanbanTaskActivityRecorder.d.ts +2 -1
- package/dist/components/MemoryManager/MemoryDetail.d.ts +2 -1
- package/dist/components/MemoryManager/MemoryEditor.d.ts +2 -1
- package/dist/components/MemoryManager/MemoryFilters.d.ts +2 -1
- package/dist/components/MemoryManager/MemoryList.d.ts +2 -1
- package/dist/components/MemoryManager/MemorySearchBreakdown.d.ts +2 -1
- package/dist/components/MemoryManager/ReviewQueue.d.ts +2 -1
- package/dist/components/MemoryManager/SageTabs.d.ts +2 -1
- package/dist/components/MemoryManager/shared.d.ts +0 -1
- package/dist/components/MessageBubble/FailedRunContinue.d.ts +12 -0
- package/dist/components/MessageBubble/utils.d.ts +6 -0
- package/dist/components/ModelPickDialog.d.ts +1 -1
- package/dist/components/ModelSelectDialog.d.ts +4 -3
- package/dist/components/NextStepsBar.d.ts +1 -6
- package/dist/components/NotificationMenu.d.ts +6 -0
- package/dist/components/OfficeMapCanvas/edges.d.ts +0 -6
- package/dist/components/OfficeMapCanvas/nodes.d.ts +0 -32
- package/dist/components/OfficeMapCanvas/use-recently-finished.d.ts +2 -1
- package/dist/components/OfficeMapCanvas/utils.d.ts +4 -10
- package/dist/components/ProcessMonitor.d.ts +2 -1
- package/dist/components/ProviderWaitingRoom.d.ts +8 -0
- package/dist/components/QueuePanel.d.ts +1 -1
- package/dist/components/QuickModelSwitcher.filter.d.ts +23 -7
- package/dist/components/RestoreTabsModal.d.ts +20 -0
- package/dist/components/SddFlowGraph.d.ts +3 -2
- package/dist/components/SessionTabBar/TabMap.d.ts +19 -0
- package/dist/components/SessionTabBar/summaries.d.ts +39 -0
- package/dist/components/SessionTabBar.d.ts +14 -0
- package/dist/components/SettingsPanel/ClearAllowlistDialog.d.ts +2 -1
- package/dist/components/SettingsPanel/ModelCatalogPicker.d.ts +2 -14
- package/dist/components/SettingsPanel/ModelEffortSelect.d.ts +12 -0
- package/dist/components/SettingsPanel/ModelListEditor.d.ts +2 -1
- package/dist/components/SettingsPanel/ModelSchemaEditor.d.ts +2 -1
- package/dist/components/SettingsPanel/ModelSection.d.ts +3 -1
- package/dist/components/SettingsPanel/ModelTiersSection.d.ts +7 -0
- package/dist/components/SettingsPanel/OAuthLoginSection.d.ts +2 -2
- package/dist/components/SettingsPanel/PluginToggleList.d.ts +3 -1
- package/dist/components/SettingsPanel/ProviderModelsPanel.d.ts +2 -1
- package/dist/components/SettingsPanel/ProviderModelsPanel.filter.d.ts +2 -1
- package/dist/components/SettingsPanel/ProviderSection.d.ts +2 -2
- package/dist/components/SettingsPanel/ToolsSection.d.ts +0 -10
- package/dist/components/SettingsPanel/brain-section-options.d.ts +3 -10
- package/dist/components/SettingsPanel/contracts.d.ts +5 -3
- package/dist/components/SettingsPanel/sync-settings-preference.d.ts +8 -0
- package/dist/components/SettingsPanel/undo-send-decision.d.ts +2 -1
- package/dist/components/SidePanel/ChangesPanel.d.ts +0 -6
- package/dist/components/SidePanel/DesignStudioPanel.d.ts +7 -0
- package/dist/components/SidePanel/SessionList.d.ts +6 -6
- package/dist/components/SystemPromptDialog.d.ts +18 -0
- package/dist/components/TaskActivityTimeline.d.ts +3 -3
- package/dist/components/TaskBoard.d.ts +1 -1
- package/dist/components/TaskCard.d.ts +2 -7
- package/dist/components/TaskExecutionAttempts.d.ts +2 -1
- package/dist/components/TaskIntelligencePanel.d.ts +1 -1
- package/dist/components/TaskRiskPanel.d.ts +4 -3
- package/dist/components/TechStackView/DependencyDetail.d.ts +2 -1
- package/dist/components/TechStackView/DependencyTable.d.ts +2 -1
- package/dist/components/TechStackView/FindingsPanel.d.ts +2 -1
- package/dist/components/TechStackView/TechStackToolbar.d.ts +2 -1
- package/dist/components/TechStackView/shared.d.ts +5 -5
- package/dist/components/Toaster.d.ts +3 -31
- package/dist/components/ToolStatsModal.d.ts +15 -0
- package/dist/components/UpdateBanner.d.ts +6 -4
- package/dist/components/WorkbenchTopbar.d.ts +1 -3
- package/dist/components/agent-roster-data.d.ts +1 -1
- package/dist/components/agents/AgentDetailSection.d.ts +2 -1
- package/dist/components/agents/AgentRosterCard.d.ts +2 -1
- package/dist/components/agents/FleetSummaryBar.d.ts +6 -3
- package/dist/components/codemap-model.d.ts +3 -2
- package/dist/components/ui/PickerCardList.d.ts +3 -2
- package/dist/components/ui/badge.d.ts +2 -2
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/concurrency-gauge.d.ts +2 -1
- package/dist/components/ui/dialog.d.ts +5 -5
- package/dist/components/ui/dropdown-menu.d.ts +8 -8
- package/dist/components/ui/event-timeline.d.ts +2 -1
- package/dist/components/ui/fleet-agent-row.d.ts +2 -7
- package/dist/components/ui/scroll-area.d.ts +2 -2
- package/dist/components/ui/sheet.d.ts +2 -2
- package/dist/components/ui/sparkline.d.ts +2 -1
- package/dist/components/vector-memory-panel/model.d.ts +2 -7
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useDesktopBridge.d.ts +2 -1
- package/dist/hooks/useF5Resilience.d.ts +0 -14
- package/dist/hooks/useFleetPolling.d.ts +2 -1
- package/dist/hooks/useGlobalKeyboardShortcuts.d.ts +4 -1
- package/dist/hooks/useIntegrationStatus.d.ts +10 -0
- package/dist/hooks/useKanbanMeta.d.ts +4 -3
- package/dist/hooks/useLiveContextDebug.d.ts +4 -3
- package/dist/hooks/useMemoryForFile.d.ts +3 -2
- package/dist/hooks/usePagination.d.ts +2 -1
- package/dist/hooks/useProviderModels.d.ts +1 -0
- package/dist/hooks/useSessionSubscription.d.ts +15 -0
- package/dist/hooks/useViewport.d.ts +2 -3
- package/dist/hooks/useWebSocket.d.ts +6 -1
- package/dist/hooks/ws-handlers/chat-handlers.d.ts +22 -10
- package/dist/hooks/ws-handlers/coordinator-handlers.d.ts +7 -0
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts +1 -3
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +22 -0
- package/dist/hooks/ws-handlers/session-context-handlers.d.ts +24 -2
- package/dist/hooks/ws-handlers/session-execution-handlers.d.ts +12 -0
- package/dist/hooks/ws-handlers/session-handlers.d.ts +3 -3
- package/dist/hooks/ws-handlers/session-replay-handlers.d.ts +31 -2
- package/dist/hooks/ws-handlers/techstack-handlers.d.ts +0 -3
- package/dist/index.html +30 -26
- package/dist/index.js +77572 -66789
- package/dist/lib/agent-office.d.ts +3 -3
- package/dist/lib/agent-session.d.ts +19 -0
- package/dist/lib/agent-status.d.ts +5 -4
- package/dist/lib/completion.d.ts +3 -2
- package/dist/lib/delegate-format.d.ts +33 -0
- package/dist/lib/favicon.d.ts +2 -1
- package/dist/lib/kanban-verification.d.ts +3 -2
- package/dist/lib/model-matrix-routes.d.ts +3 -3
- package/dist/lib/plugin-enablement.d.ts +1 -1
- package/dist/lib/reasoning-effort.d.ts +76 -0
- package/dist/lib/sdd-theme.d.ts +4 -3
- package/dist/lib/task-brief-preview.d.ts +5 -0
- package/dist/lib/terminal-dock.d.ts +0 -1
- package/dist/lib/view-navigation.d.ts +2 -2
- package/dist/lib/ws-client-actions.d.ts +1 -0
- package/dist/lib/ws-client-domain-methods.d.ts +45 -5
- package/dist/lib/ws-client-utils.d.ts +33 -0
- package/dist/lib/ws-client.d.ts +135 -6
- package/dist/manifest.json +17 -0
- package/dist/protocol-compatibility.d.ts +0 -10
- package/dist/stores/auto-submit-streak.d.ts +3 -1
- package/dist/stores/chat-lanes.d.ts +279 -0
- package/dist/stores/chat-retention.d.ts +2 -4
- package/dist/stores/chat-store-types.d.ts +1 -0
- package/dist/stores/chat-store.d.ts +46 -25
- package/dist/stores/chimera-hub-store.d.ts +140 -0
- package/dist/stores/chimera-reports-store.d.ts +45 -0
- package/dist/stores/codemap-activity-store.d.ts +4 -4
- package/dist/stores/context-editor-store.d.ts +4 -5
- package/dist/stores/coordinator-monitor-store.d.ts +3 -2
- package/dist/stores/council-log-store.d.ts +6 -20
- package/dist/stores/file-store.d.ts +32 -13
- package/dist/stores/fleet-store.d.ts +49 -5
- package/dist/stores/git-changes-store.d.ts +25 -1
- package/dist/stores/goal-run-store.d.ts +2 -2
- package/dist/stores/history-store.d.ts +11 -0
- package/dist/stores/index.d.ts +17 -9
- package/dist/stores/local-prefs.d.ts +87 -0
- package/dist/stores/mailbox-store.d.ts +2 -2
- package/dist/stores/memory-injector-store.d.ts +2 -2
- package/dist/stores/memory-lifecycle-store.d.ts +6 -2
- package/dist/stores/monitor-store.d.ts +3 -2
- package/dist/stores/notification-store.d.ts +141 -0
- package/dist/stores/provider-status-store.d.ts +19 -0
- package/dist/stores/restore-tabs-store.d.ts +29 -0
- package/dist/stores/resume-progress-store.d.ts +58 -0
- package/dist/stores/session-inspect-store.d.ts +1 -1
- package/dist/stores/session-lanes.d.ts +242 -0
- package/dist/stores/session-scoped-store.d.ts +56 -0
- package/dist/stores/session-store.d.ts +97 -154
- package/dist/stores/session-tab-store.d.ts +197 -0
- package/dist/stores/side-effect-store.d.ts +9 -1
- package/dist/stores/system-prompt-store.d.ts +48 -0
- package/dist/stores/tool-stats-store.d.ts +52 -0
- package/dist/stores/types.d.ts +81 -4
- package/dist/stores/ui-store.d.ts +113 -11
- package/dist/types/brain.d.ts +17 -16
- package/dist/types/chronicle.d.ts +3 -2
- package/dist/types/client-message.d.ts +139 -23
- package/dist/types/collab.d.ts +0 -2
- package/dist/types/protocol-core.d.ts +62 -6
- package/dist/types/server-message.d.ts +204 -3
- package/dist/types/skills-design.d.ts +2 -1
- package/package.json +11 -11
- package/dist/assets/AgentRosterView-p5iiedCA.js +0 -9
- package/dist/assets/AnalyticsDashboard-B0sbSAxw.js +0 -1
- package/dist/assets/AudienceMemoryPanel-DcDONq7t.js +0 -3
- package/dist/assets/ChangesView-CD3JR3qY.js +0 -1
- package/dist/assets/ChronicleDashboard-3tJUiU7K.js +0 -1
- package/dist/assets/CodeEditor-0RJa9mSq.js +0 -2
- package/dist/assets/CodeMap-BvqQN6MG.js +0 -1
- package/dist/assets/ConfirmModal-CRSE2t_c.js +0 -1
- package/dist/assets/DesignGalleryView-BKl6Ce71.js +0 -1
- package/dist/assets/GoalView-Db55m-Nq.js +0 -1
- package/dist/assets/KanbanView-BQ7duNsz.js +0 -3
- package/dist/assets/MailboxDetailView-CgHzqllF.js +0 -1
- package/dist/assets/MemoryDrawer-BNTsi4jl.js +0 -1
- package/dist/assets/MemoryManager-B4NAvfYx.js +0 -1
- package/dist/assets/ModelPicker-BtK3pwfC.js +0 -1
- package/dist/assets/OfficeMapPanel-Bk9q12hP.js +0 -4
- package/dist/assets/ProcessMonitor-BTndLGIV.js +0 -1
- package/dist/assets/PromptJournalView-DbwN6AWe.js +0 -1
- package/dist/assets/QueuePanel-Cb1mIIuO.js +0 -1
- package/dist/assets/RefreshDebugView-CzGncYqB.js +0 -1
- package/dist/assets/RequirementIntakeView-BgKJbUlD.js +0 -1
- package/dist/assets/SageTabs-mB6lxkdD.js +0 -2
- package/dist/assets/SddFlowGraph-C484p5L9.js +0 -1
- package/dist/assets/SddHub-DsD8ORZo.js +0 -2
- package/dist/assets/SessionInspectView-DtM6MBbL.js +0 -1
- package/dist/assets/SessionList-CCaEa3iW.js +0 -1
- package/dist/assets/SessionsDashboard-CxatSEv6.js +0 -1
- package/dist/assets/SetupScreen-CBkuOnoN.js +0 -1
- package/dist/assets/SkillDetailView-DKVIAnwb.js +0 -3
- package/dist/assets/TechStackView-B6WDU-tt.js +0 -2
- package/dist/assets/TerminalPanel-Dfkt3xtA.js +0 -1
- package/dist/assets/Toaster-CcgCyzaU.js +0 -1
- package/dist/assets/activity-BA8C9ueU.js +0 -9
- package/dist/assets/activity-BYnOci5N.js +0 -9
- package/dist/assets/activity-COQ9xSFu.js +0 -9
- package/dist/assets/activity-CuJqhGz7.js +0 -9
- package/dist/assets/activity-D3ZccGOh.js +0 -9
- package/dist/assets/activity-YMES6OPI.js +0 -9
- package/dist/assets/activity-zlMMaNE1.js +0 -9
- package/dist/assets/chat-CzaGXz_W.js +0 -1
- package/dist/assets/chat-store-BiEXyguk.js +0 -17
- package/dist/assets/codemap-index-store-CDhApwWQ.js +0 -1
- package/dist/assets/i18n-BeHaHx3x.js +0 -2
- package/dist/assets/index-B8J_xxU5.css +0 -1
- package/dist/assets/index-BLI23QVE.js +0 -134
- package/dist/assets/session-store-CKpAwNIm.js +0 -1
- package/dist/assets/settings-BNbqEBSr.js +0 -1
- package/dist/assets/settings-BsZgLIo2.js +0 -1
- package/dist/assets/settings-C3OnmFrY.js +0 -1
- package/dist/assets/settings-C3bNf1Bx.js +0 -1
- package/dist/assets/settings-C9FOpDBt.js +0 -1
- package/dist/assets/settings-oeXlO4HA.js +0 -1
- package/dist/assets/stores-BskP1BVl.js +0 -7
- package/dist/assets/toasts-BCDGDcyq.js +0 -1
- package/dist/assets/toasts-BwQJwYLe.js +0 -1
- package/dist/assets/toasts-CFzweRH5.js +0 -1
- package/dist/assets/toasts-DDYQsJV8.js +0 -1
- package/dist/assets/toasts-DOfXc7Rt.js +0 -1
- package/dist/assets/toasts-Dm12Nq8t.js +0 -1
- package/dist/assets/toasts-frBt6fvE.js +0 -1
- package/dist/assets/ui-store-3HoYrTu5.js +0 -1
- package/dist/assets/useWebSocket-6jp275vG.js +0 -29
- package/dist/assets/utils-BecmXwgG.js +0 -1
- package/dist/assets/view-navigation-C1UDTk5R.js +0 -1
- package/dist/assets/ws-client-C6jAU4nL.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$n as t,Ba as n,Bi as r,Bt as i,Ea as a,En as o,Ga as s,Hi as c,Hn as l,Ji as u,Jt as d,Mt as f,Oi as p,Ot as m,Pa as h,Pi as g,Pr as _,Qr as v,Qt as y,St as b,Ti as x,Tn as S,Vn as C,Wt as w,Xi as T,Yt as E,Zt as D,a as ee,an as te,c as ne,ci as O,cn as k,da as re,dt as A,f as ie,fn as ae,g as oe,gn as se,hn as ce,i as le,in as ue,jn as de,jt as fe,lt as pe,ma as j,mn as me,na as M,or as he,qi as N,qn as ge,r as _e,ra as P,sr as F,ta as I,un as ve,vr as ye,wa as L,xi as R,xn as z,yi as be,yn as B,zi as xe}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as Se}from"./ws-client-C6jAU4nL.js";import{t as V}from"./utils-BecmXwgG.js";import{t as Ce}from"./session-store-CKpAwNIm.js";import{E as we,R as Te,h as Ee,m as De}from"./stores-BskP1BVl.js";import{n as Oe}from"./ui-store-3HoYrTu5.js";import{n as ke,o as Ae,r as H,t as je}from"./dialog-DPl7DolS.js";import{n as Me,t as Ne}from"./ModelPicker-BtK3pwfC.js";import{b as Pe,c as Fe,x as Ie}from"./index-BLI23QVE.js";import{t as Le,u as Re}from"./SddFlowGraph-C484p5L9.js";var U=e(s(),1);function ze(e,t=!0){(0,U.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 Be=2592e5,Ve=new Set([`completed`,`archived`]),He=524288;function Ue(e,t){let n=lt(t.now);if(n===null)throw TypeError(`Kanban audit requires a valid current time`);let r=Qe(e,t.defaultReviewStaleAfterMs??Be),i=Ze(e),a=Xe(e),o=[];for(let s of e.tasks)Ve.has(s.status)||(We(o,s,t.requireDueDate===!0,a),qe(o,s,n),Je(o,s,n,r),i.length>1&&Ye(o,s,i));return Ge(o,e),o.sort(ut),{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 We(e,t,n,r){W(t.description)||G(e,t,`missing-description`,`warning`,`Add a description`),(r?[t.assignee,t.assignedAgent,t.assignment?.agentId,t.assignment?.name].some(W):tt(t).length>0)||G(e,t,`missing-assignee`,`warning`,`Assign an owner`),n&<(t.dueDate)===null&&G(e,t,`missing-due-date`,`warning`,`Set a valid due date`),!at(t.labels)&&(r||!at(t.tags))&&G(e,t,`missing-labels`,`warning`,r?`Add at least one label`:`Add labels or tags`),!at(t.childTaskIds)&&(r||!ot(t.subtasks))&&G(e,t,`missing-subtasks`,`warning`,r?`Persist at least one child task`:`Define subtasks`),st(t.successCriteria,r)||G(e,t,`missing-success-criteria`,`warning`,`Add success criteria`)}function Ge(e,t){let n=Ke(t);n<=He||e.push({id:`${t.id}:board-oversized`,taskId:t.id,taskTitle:t.title,code:`board-oversized`,severity:`warning`,message:`Board is ~${Math.round(n/1024)} KB across ${t.tasks.length} cards; archive completed cards before it stops syncing to HQ`})}function Ke(e){try{return JSON.stringify(e)?.length??0}catch{return 0}}function qe(e,t,n){let r=t.assignment;if(t.status!==`in_progress`&&r?.status!==`running`)return;let i=tt(t),a=[r?.leaseId,r?.claimedAt,r?.heartbeatAt,r?.leaseExpiresAt].every(e=>W(e));if(r?.status!==`running`||i.length===0||!a){G(e,t,`abandoned-running-task`,`error`,`Running without a complete assignment lease`);return}let o=lt(r.leaseExpiresAt);if(o===null||o<=n){G(e,t,`stale-running-task`,`error`,`Assignment lease is expired`);return}}function Je(e,t,n,r){if(t.status!==`review`)return;let i=et(t,`review`)??lt(t.updatedAt);i===null||n-i<=r||G(e,t,`stale-review`,`warning`,`Waiting in review for ${Math.max(1,Math.floor((n-i)/36e5))}h`)}function Ye(e,t,n){let r=$e(t);if(r.length<2)return;let i=new Map(n.map((e,t)=>[rt(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(rt(a.state)),c=i.get(rt(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 Xe(e){return[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle].some(e=>!!e&&typeof e==`object`&&!Array.isArray(e)&&e.mode===`managed`)}function Ze(e){let t=[e.lifecycle,e.lifecyclePolicy,e.managedLifecycle];for(let e of t){let t=nt(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)return[`backlog`,`todo`,`running`,`review`,`done`];for(let e of[n.states,n.statuses,n.order,n.managedStatuses]){let t=nt(e);if(t.length>1)return t}}return[]}function Qe(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(ct(t.staleReviewAfterMs))return t.staleReviewAfterMs;if(ct(t.reviewStaleAfterMs))return t.reviewStaleAfterMs;if(ct(t.reviewStaleHours))return t.reviewStaleHours*60*60*1e3}return t}function $e(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=it(t.status,t.state,t.toStatus,t.to,t.columnId);r&&n.push({state:r,at:lt(t.at??t.ts??t.timestamp??t.changedAt??t.createdAt)})}return n}function et(e,t){let n=null;for(let r of $e(e))rt(r.state)===rt(t)&&r.at!==null&&(n=n===null?r.at:Math.max(n,r.at));return n}function tt(e){let t=e.assignment;return[e.assignee,e.assignedAgent,t?.agentId,t?.subagentId,t?.name].filter(W)}function nt(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=it(e.id,e.status,e.state,e.name);r&&t.push(r)}return t}function rt(e){return e.trim().toLowerCase()}function it(...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 at(e){return Array.isArray(e)&&e.some(W)}function ot(e){return Array.isArray(e)?e.some(e=>{if(W(e))return!0;if(!e||typeof e!=`object`)return!1;let t=e;return[t.id,t.taskId,t.title,t.description].some(W)}):!1}function st(e,t){return Array.isArray(e)&&e.length>0&&e.every(e=>!t&&W(e)?!0:!!e&&typeof e==`object`&&W(e.description))}function ct(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function lt(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 ut(e,t){let n=dt(e.severity)-dt(t.severity);if(n!==0)return n;let r=e.taskTitle.localeCompare(t.taskTitle);return r===0?e.message.localeCompare(t.message):r}function dt(e){return e===`error`?0:1}function ft(e){let t=Te(e=>e.wsUrl),n=Te(e=>e.provider),r=Te(e=>e.model),[i,a]=(0,U.useState)([]),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)({}),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(``);return(0,U.useEffect)(()=>{let e=Se(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,U.useEffect)(()=>{e&&Se(t).send({type:`kanban.meta`})},[e,t]),{tools:i,skills:o,fallbackProfiles:c,sessionProvider:u||n,sessionModel:f||r}}var K=pe();function pt({options:e,selected:t,onChange:r,placeholder:i,emptyLabel:a}){let{t:o}=n(),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(``),d=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!s)return;let e=e=>{d.current&&!d.current.contains(e.target)&&c(!1)};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[s]);let f=(0,U.useMemo)(()=>{let t=new Map(e.map(e=>[e.value,e.label]));return e=>t.get(e)??e},[e]),p=(0,U.useMemo)(()=>{let t=l.trim().toLowerCase();return(t?e.filter(e=>`${e.value} ${e.label} ${e.tag??``}`.toLowerCase().includes(t)):e).slice(0,80)},[e,l]),m=e=>{r(t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,K.jsxs)(`div`,{ref:d,className:`relative`,children:[t.length>0&&(0,K.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:t.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:f(e)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`text-muted-foreground hover:text-destructive`,"aria-label":`Remove ${f(e)}`,children:(0,K.jsx)(A,{size:11})})]},e))}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>c(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)(S,{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:i??`Add…`}),(0,K.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}),s&&(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:l,onChange:e=>u(e.target.value),placeholder:o(`activity:chipMultiSelect.filter`),className:`min-w-0 flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground`}),l&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>u(``),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:[p.map(e=>{let n=t.includes(e.value);return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>m(e.value),className:V(`flex w-full items-start gap-1.5 px-2 py-1.5 text-left text-xs transition-colors hover:bg-muted`,n?`bg-primary/8 text-primary`:`text-foreground`),children:[n?(0,K.jsx)(P,{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)}),p.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-3 text-center text-[11px] text-muted-foreground`,children:e.length===0?a??`Nothing available`:`No match`})]})]})]})}function mt(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 ht(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 gt({presence:e=[]}){let{t}=n();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:V(`h-2 w-2 shrink-0 rounded-full`,e.active?`bg-success`:`bg-muted-foreground/50`)}),(0,K.jsx)(r,{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)(g,{size:12,className:`text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`time`,{dateTime:e.lastSeenAt,className:`tabular-nums text-muted-foreground`,children:mt(e.lastSeenAt)})]},e.id))]})}function _t({board:e,snapshot:t,sendKanban:r}){let{t:i}=n(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!0),[l,u]=(0,U.useState)(`deterministic`),[d,f]=(0,U.useState)(`session`),[p,m]=(0,U.useState)(``),[g,_]=(0,U.useState)(``),[v,y]=(0,U.useState)(``),[b,x]=(0,U.useState)([]),[S,C]=(0,U.useState)([]),[w,T]=(0,U.useState)(10),E=Me(a&&l===`agentic`),ee=ft(a&&l===`agentic`);(0,U.useEffect)(()=>{let t=e.supervisor;c(t?.enabled??!0),u(t?.mode??`deterministic`),f(t?.routing?.mode??`session`),m(t?.routing?.provider??``),_(t?.routing?.model??``),y(t?.routing?.fallbackProfile??``),x(t?.routing?.fallbackModels??[]),C(t?.skills??[]),T(Math.max(2,Math.round((t?.intervalMs??1e4)/1e3)))},[e.id,JSON.stringify(e.supervisor)]);let te=()=>{let t={mode:d,...d===`fixed`&&p?{provider:p}:{},...d===`fixed`&&g?{model:g}:{},...d===`fallback_profile`&&v?{fallbackProfile:v}:{},...b.length?{fallbackModels:b}:{}};r(`kanban.update`,{boardId:e.id,supervisor:{enabled:s,mode:l,intervalMs:Math.max(2,w)*1e3,recoveryMode:`auto`,...l===`agentic`?{routing:t,skills:S}:{}}}),window.setTimeout(()=>r(`kanban.supervisor.audit`,{boardId:e.id}),150)},ne=s?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:()=>o(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)(D,{size:13,className:ne===`healthy`?`text-success`:`text-warning`}),(0,K.jsx)(`span`,{className:`font-semibold`,children:i(`activity:kanban.kanbanAgent`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 capitalize text-muted-foreground`,children:[l,` · `,ne]}),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?i(`activity:kanban.checkedAgo`,{ago:ht(t.lastAuditAt)}):i(`activity:kanban.notChecked`)}),(0,K.jsx)(M,{size:13,className:V(`transition-transform`,a&&`rotate-180`)})]}),a&&(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:s,onChange:e=>c(e.target.checked)}),(0,K.jsx)(`span`,{children:i(`activity:kanban.watchThisBoard`)})]}),(0,K.jsx)(vt,{label:i(`activity:kanban.supervisorEngine`),value:l,options:[`deterministic`,`agentic`],onChange:e=>u(e)}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:i(`activity:kanban.auditInterval`)}),(0,K.jsx)(`input`,{type:`number`,min:2,value:w,onChange:e=>T(Number(e.target.value)||2),className:`h-8 w-full rounded-md border bg-background px-2 outline-none focus:border-primary`})]}),(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:te,className:`inline-flex h-8 items-center gap-1 rounded-md bg-primary px-3 text-primary-foreground`,children:[(0,K.jsx)(ve,{size:13}),` `,i(`activity:boardChrome.save`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`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)(h,{size:13}),` `,i(`activity:boardChrome.auditNow`)]})]}),l===`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:i(`activity:boardChrome.deterministicModeUsesNoProviderModel`)}):(0,K.jsxs)(`div`,{className:`grid gap-3 lg:col-span-4 lg:grid-cols-2`,children:[(0,K.jsx)(vt,{label:i(`activity:kanban.kanbanAgentModelSource`),value:d,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>f(e)}),d===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:i(`activity:boardChrome.fixedProviderModel`)}),(0,K.jsx)(Ne,{value:g||void 0,provider:p||void 0,candidates:E,placeholder:i(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{_(e),m(t)}})]}),d===`fallback_profile`&&(0,K.jsx)(vt,{label:i(`activity:kanban.fallbackProfile`),value:v,options:Object.keys(ee.fallbackProfiles),placeholder:i(`activity:kanban.selectProfile`),onChange:y}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:i(`activity:kanban.supervisorSkills`)}),(0,K.jsx)(pt,{options:ee.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:S,onChange:C,placeholder:i(`activity:kanban.forceLoadSkills`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:i(`activity:kanban.extraFallbackModels`)}),(0,K.jsx)(pt,{options:E.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,tag:e.provider})),selected:b,onChange:x,placeholder:i(`activity:kanban.optionalFallbacks`)})]})]})]})]})}function vt({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 yt({boardTotal:e,activeBoardTotal:t,orphanedBoardTotal:r,activeBoardId:i,activeBoards:o,orphanedBoards:s,boardPage:c,boardPageSize:l,loading:u,newBoardTitle:d,onClose:f,onRefresh:m,onNewBoardTitleChange:h,onCreateBoard:g,onBoardSelect:_,onBoardPageChange:v}){let{t:y}=n();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:y(`common:action.back`),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)(a,{size:16})}),(0,K.jsx)(p,{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:y(`activity:kanban.kanban`)}),(0,K.jsxs)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:[e,` boards · `,t,` active · `,r,` orphaned`]})]}),(0,K.jsx)(`button`,{type:`button`,title:y(`common:action.refresh`),onClick:m,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)(B,{size:15,className:u?`animate-spin`:void 0})})]}),(0,K.jsxs)(`div`,{className:`flex gap-1 border-b p-2`,children:[(0,K.jsx)(`input`,{value:d,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g()},placeholder:y(`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:y(`activity:kanban.createBoard`),onClick:g,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)(S,{size:16})})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-2`,children:[o.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 · `,o.length]}),o.map(e=>(0,K.jsx)(bt,{board:e,active:i===e.id,dotClassName:`bg-success`,onSelect:_},e.id)),s.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 · `,s.length]}),s.map(e=>(0,K.jsx)(bt,{board:e,active:i===e.id,dotClassName:`bg-muted-foreground/45`,onSelect:_},e.id))]}),(0,K.jsx)(Pe,{page:c,pageSize:l,totalItems:e,onPageChange:v,compact:!0,itemLabel:`boards`})]})}function bt({board:e,active:t,dotClassName:n,onSelect:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:V(`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:V(`h-1.5 w-1.5 rounded-full`,n)}),e.taskCount,` tasks`]}),(0,K.jsxs)(`span`,{children:[e.completedTaskCount,` done`]})]})]})}function xt(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 St(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 Ct(e){let t=e?.tags??[],n=t.includes(`sdd`)?`sdd`:t.includes(`goal`)?`goal`:null;if(!n)return null;let r=t.find(e=>e.startsWith(`run:`))?.slice(4);return{engine:n,...r?{runId:r}:{}}}var wt={enabled:!1,enforcement:`confirm`,shellAccess:`confirm`,allow:[]};function Tt({title:e,value:t,inherited:r,onSave:i}){let{t:a}=n(),[o,s]=(0,U.useState)(t??wt),[c,l]=(0,U.useState)(Dt(t?.allow??[])),[u,d]=(0,U.useState)(Dt(t?.deny??[])),[f,p]=(0,U.useState)(null);return(0,U.useEffect)(()=>{s(t??wt),l(Dt(t?.allow??[])),d(Dt(t?.deny??[])),p(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)(D,{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}`:r?.enabled?`inherits board boundary`:`unrestricted`})]}),(0,K.jsxs)(`div`,{className:`space-y-2 border-t p-3 text-xs`,children:[r?.enabled&&(0,K.jsx)(`div`,{className:`rounded border border-warning/25 bg-warning/10 px-2 py-1.5 text-muted-foreground`,children:a(`activity:kanbanBoundaryEditor.boardPolicyRemainsAuthoritativeThisTask`)}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:o.enabled,onChange:e=>s({...o,enabled:e.target.checked})}),a(`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:a(`activity:kanban.outsideScope`)}),(0,K.jsxs)(`select`,{value:o.enforcement,onChange:e=>s({...o,enforcement:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:a(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:a(`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:a(`activity:kanbanBoundaryEditor.shellOpaqueTools`)}),(0,K.jsxs)(`select`,{value:o.shellAccess,onChange:e=>s({...o,shellAccess:e.target.value}),className:`h-8 w-full rounded border bg-background px-2`,children:[(0,K.jsx)(`option`,{value:`confirm`,children:a(`activity:kanban.askPermission`)}),(0,K.jsx)(`option`,{value:`block`,children:a(`activity:kanban.alwaysBlock`)}),(0,K.jsx)(`option`,{value:`allow`,children:a(`activity:kanban.allow`)})]})]})]}),(0,K.jsx)(Et,{label:a(`activity:kanban.allowSelectors`),value:c,onChange:l}),(0,K.jsx)(Et,{label:a(`activity:kanban.denySelectors`),value:u,onChange:d}),(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. `,a(`activity:kanban.crossPathSelectors`)]}),f&&(0,K.jsx)(`div`,{className:`text-destructive`,children:f}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{try{let e=Ot(c),t=Ot(u);i({...o,allow:e,deny:t}),p(null)}catch(e){p(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)(ve,{size:13}),` `,a(`activity:kanbanBoundaryEditor.saveBoundary`)]}),t&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(null),className:`h-8 rounded border px-3 text-muted-foreground hover:bg-muted`,children:a(`activity:kanban.removeLayer`)})]})]})]})}function Et({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 Dt(e){return e.map(e=>`${e.kind}:${e.access}:${e.path}`).join(`
|
|
2
|
-
`)}function Ot(e){let t=new Set([`file`,`directory`,`package`,`glob`]),n=new Set([`read`,`write`,`read_write`]);return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,r)=>{let i=e.indexOf(`:`),a=e.indexOf(`:`,i+1);if(i<=0||a<=i+1||a===e.length-1)throw Error(`Boundary line ${r+1} must use kind:access:path.`);let o=e.slice(0,i),s=e.slice(i+1,a),c=e.slice(a+1).trim();if(!c)throw Error(`Boundary line ${r+1} must use kind:access:path.`);if(!t.has(o))throw Error(`Boundary line ${r+1} has unknown kind.`);if(!n.has(s))throw Error(`Boundary line ${r+1} has unknown access.`);return{kind:o,access:s,path:c}})}function kt({audit:e,onSelectTask:t}){let[n,r]=(0,U.useState)(!0),i=(0,U.useId)(),a=(0,U.useRef)(null);if((0,U.useEffect)(()=>{let t=new Set(e.issues.map(e=>e.id)),n=a.current;a.current=t,n!==null&&[...t].some(e=>!n.has(e))&&r(!0)},[e.issues]),e.issues.length===0)return null;let o=At(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)(w,{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)(T,{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)(m,{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)(M,{size:14,"aria-hidden":`true`,className:V(`transition-transform`,n&&`rotate-180`)})})]}),n&&(0,K.jsx)(`ul`,{id:i,className:`grid max-h-36 gap-1 overflow-y-auto px-3 pb-2 sm:grid-cols-2 sm:px-4 xl:grid-cols-3`,children:o.map(({taskId:e,taskTitle:n,issues:r})=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"aria-label":`Open ${n}: ${r.map(e=>e.message).join(`, `)}`,className:`group flex w-full items-start gap-2 rounded-md border border-border/70 bg-background/70 px-2.5 py-2 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:[(0,K.jsx)(`span`,{className:V(`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 At(e){let t=new Map;for(let n of e){let e=t.get(n.taskId);e?e.issues.push(n):t.set(n.taskId,{taskId:n.taskId,taskTitle:n.taskTitle,issues:[n]})}return[...t.values()]}var jt=[`id`,`name`,`type`];function q(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 jt){let n=t[e];if(typeof n==`string`&&n.trim())return n.trim()}}function Mt(e,t){return t?`running`:e.verificationReport?.verdict||`unverified`}var Nt=new Set([`completed`,`review`,`failed`]);function Pt(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(Nt.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 Ft(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 It(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 Lt(e,t){return e?.columns.find(e=>e.id===t)?.title??t}function Rt({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 J({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 zt({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 Bt(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 Vt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Ht(e){return e===`completed`||e===`failed`||e===`cancelled`}function Ut(e,t){return t?Math.round(e/t*100):0}function Wt(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)>3e5&&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 _=Ut(o.filter(e=>!!e.actor).length,o.length),v=Ut(o.filter(e=>!!e.sessionId).length,o.length),y=Ut(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={...Vt([...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=>Ht(String(Vt(e.after).status??``))&&!!e.note?.trim()));return Ht(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 Gt(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 Kt({board:e,task:t,events:r}){let{t:i}=n(),a=Wt(e,t,r),o=Ie(a.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)(y,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:i(`activity:taskRisk.riskAuditQuality`)}),(0,K.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${a.score>=90?`bg-success/10 text-success`:a.score>=70?`bg-warning/10 text-warning`:`bg-destructive/10 text-destructive`}`,children:i(`activity:taskRisk.auditScore`,{score:a.score})}),a.critical>0&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-[9px] text-destructive`,children:i(`activity:taskRisk.criticalCount`,{count:a.critical})}),(0,K.jsx)(M,{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:[[i(`activity:taskRisk.covEvents`),a.coverage.durableEvents],[i(`activity:taskRisk.covActor`),`${a.coverage.actorPercent}%`],[i(`activity:taskRisk.covSession`),`${a.coverage.sessionPercent}%`],[i(`activity:taskRisk.covReasons`),`${a.coverage.reasonPercent}%`],[i(`activity:taskRisk.covRoute`),a.coverage.hasExecutionRoute?i(`common:action.yes`):i(`common:action.no`)],[i(`activity:taskRisk.covOutcome`),a.coverage.hasTerminalEvidence?i(`common:action.yes`):i(`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)))}),a.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)(u,{className:`size-4`}),` `,i(`activity:taskRisk.noDeterministicTaskRisksDetected`)]}):(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[o.pageItems.map(e=>(0,K.jsxs)(`section`,{className:`rounded border px-2.5 py-2 ${Gt(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)(R,{className:`size-3.5`}):(0,K.jsx)(m,{className:`size-3.5`}),i(e.titleKey),(0,K.jsxs)(`span`,{className:`ml-auto text-[8px] uppercase opacity-75`,children:[i(`activity:taskRisk.cat.${e.category}`),` ·`,` `,i(`activity:taskRisk.sev.${e.severity}`)]})]}),(0,K.jsx)(`p`,{className:`mt-1 text-[10px] leading-4 opacity-90`,children:i(e.detailKey,e.detailParams??{})}),(0,K.jsxs)(`p`,{className:`mt-1 text-[9px] leading-4 opacity-75`,children:[(0,K.jsx)(`strong`,{children:i(`activity:taskRisk.next`)}),` `,i(e.remediationKey)]})]},e.id)),(0,K.jsx)(Pe,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,compact:!0,itemLabel:i(`activity:taskRisk.itemLabel`)})]})]})]})}function qt(e,t,n){let r=t.assignment,i=Wt(e,t,[]).findings.filter(e=>e.category===`operational`),a=q(r?.provider),o=q(r?.model);return{owner:q(r?.name)??q(r?.agentId)??q(r?.role)??q(t.assignee)??q(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:Mt(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 Jt(e){let t=e.tasks.map(e=>`${e.id}:${e.status}`).sort().join(`|`),n=(e.presence??[]).filter(e=>e.active).map(e=>e.taskId).sort().join(`|`);return`${e.id}|${t}|${n}`}function Yt(e){let t=e.assignment;return[e.id,e.status,e.dueDate??``,e.assignee??``,e.assignedAgent??``,JSON.stringify(e.dependsOn??null),JSON.stringify(e.childTaskIds??null),JSON.stringify((e.successCriteria??[]).map(e=>`${e.id}:${e.status}`)),e.atomicityAssessment?.verdict??``,e.verificationReport?.attachments.length??0,e.decomposition?.status??``,t?JSON.stringify({provider:t.provider,model:t.model,name:t.name,agentId:t.agentId,role:t.role,attempt:t.attempt,maxAttempts:t.maxAttempts,fallbackProfile:t.fallbackProfile,fallbackModels:t.fallbackModels,status:t.status,error:t.error,lastFailureKind:t.lastFailureKind,lastResult:t.lastResult,leaseExpiresAt:t.leaseExpiresAt,heartbeatAt:t.heartbeatAt,modelRouting:t.modelRouting}):``].join(`:`)}function Xt({board:e,column:t,selectedTaskId:r,dragTaskId:i,setDragTaskId:a,onSelectTask:o,onDeleteTask:s,onMoveTask:c}){let{t:l}=n(),u=De(e=>e.verificationActivity),[d,f]=(0,U.useState)(!1),p=(0,U.useRef)(0),[m,h]=(0,U.useState)(null);(0,U.useEffect)(()=>{i===null&&(p.current=0,f(!1))},[i]),(0,U.useEffect)(()=>{if(m===null)return;let e=window.setTimeout(()=>h(null),4e3);return()=>window.clearTimeout(e)},[m]);let g=(0,U.useRef)(new Map),_=Jt(e),v=Math.floor(Date.now()/6e4);(0,U.useEffect)(()=>{g.current.clear()},[_,v]);let y=e.tasks.filter(e=>e.columnId===t.id).sort((e,t)=>e.order-t.order),b=y.length===0,x=t=>{let n=g.current,r=`${_}|${v}|${Yt(t)}`,i=n.get(r);if(i){let a=u?.[`${e.id}:${t.id}`],o=Mt(t,a);if(o===i.verification)return i;let s={...i,verification:o};return n.set(r,s),s}let a=qt(e,t,u);return n.set(r,a),a};return(0,K.jsxs)(`section`,{className:V(`flex h-full shrink-0 flex-col rounded-md border bg-muted/25 transition-[width] duration-200`,d&&`border-primary/70 bg-primary/5`,b?`w-[180px]`:`w-[310px]`),children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b px-3`,children:[(0,K.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full`,style:{background:t.color??`hsl(var(--primary))`}}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-sm font-semibold`,children:t.title}),(0,K.jsx)(`span`,{className:`rounded bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:y.length})]}),(0,K.jsx)(`ul`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto p-2 [scrollbar-gutter:stable]`,onDragEnter:e=>{e.preventDefault(),p.current+=1,f(!0)},onDragLeave:()=>{p.current=Math.max(0,p.current-1),p.current===0&&f(!1)},onDragOver:e=>{e.preventDefault(),d||f(!0)},onDrop:n=>{if(n.preventDefault(),p.current=0,f(!1),e.lifecycle?.mode===`managed`){a(null);return}let r=n.dataTransfer.getData(`text/plain`)||i;r&&e.tasks.some(e=>e.id===r)&&c(r,t.id),a(null)},children:y.map(t=>{let n=x(t);return(0,K.jsxs)(`li`,{draggable:e.lifecycle?.mode!==`managed`,onDragStart:n=>{e.lifecycle?.mode!==`managed`&&(a(t.id),n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,t.id))},onDragEnd:()=>a(null),className:V(`relative rounded-md border bg-background p-3 shadow-sm transition-colors`,r===t.id?`border-primary`:`hover:border-primary/50`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Select task: ${t.title}`,onClick:()=>o(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||n.atomicityVerdict)&&(0,K.jsx)(`span`,{className:V(`shrink-0 rounded px-1 py-0.5 text-[10px] font-medium`,n.atomicityVerdict===`needs_decomposition`?`bg-destructive/15 text-destructive`:n.atomicityVerdict===`composite`?`bg-info/15 text-info`:n.atomicityVerdict===`borderline`||t.atomic?`bg-warning/15 text-warning`:`bg-muted text-muted-foreground`),title:n.atomicityVerdict?`Atomicity: ${n.atomicityVerdict}`:`Atomic task (subtree verification required)`,children:t.atomic?`atomic`:n.atomicityVerdict===`needs_decomposition`?`split me`:n.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:m===t.id?l(`activity:kanban.confirmDeleteTask`):l(`activity:kanban.deleteTask`),"aria-label":m===t.id?l(`activity:kanban.confirmDeleteTaskAria`,{title:t.title}):l(`activity:kanban.deleteTaskAria`,{title:t.title}),onClick:()=>{m===t.id?(h(null),s(t)):h(t.id)},onBlur:()=>h(e=>e===t.id?null:e),className:V(`pointer-events-auto relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-colors`,m===t.id?`bg-destructive/15 text-destructive ring-1 ring-destructive/40`:`text-muted-foreground hover:bg-destructive/10 hover:text-destructive`),children:(0,K.jsx)(fe,{size:14})})]}),(0,K.jsxs)(`div`,{className:`pointer-events-none relative mt-2 flex flex-wrap items-center gap-1.5 text-[11px]`,children:[e.lifecycle?.mode!==`managed`&&(0,K.jsx)(`select`,{"aria-label":l(`activity:kanban.moveTaskToColumn`,{title:t.title}),value:t.columnId,draggable:!1,onDragStart:e=>e.stopPropagation(),onChange:e=>{e.target.value!==t.columnId&&c(t.id,e.target.value)},className:`pointer-events-auto relative max-w-28 cursor-pointer rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-primary`,children:e.columns.map(e=>(0,K.jsx)(`option`,{value:e.id,children:e.title},e.id))}),(0,K.jsx)(`span`,{className:Bt(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}),n.owner!==`Unassigned`&&(0,K.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-primary`,children:n.owner}),t.assignment&&(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:n.route}),t.assignment?.attempt?(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[`attempt `,n.attempts]}):null,n.fallbackCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[n.fallbackCount,` fallback`]}),n.blockers>0?(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[n.blockers,` blocker`]}):null,n.activeUsers>0&&(0,K.jsxs)(`span`,{className:`rounded bg-success/10 px-1.5 py-0.5 text-success`,children:[n.activeUsers,` active`]}),n.failed&&(0,K.jsx)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:l(`activity:kanban.runFailed`)}),n.criticalRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-destructive/10 px-1.5 py-0.5 text-destructive`,children:[n.criticalRisks,` critical risk`]}),n.warningRisks>0&&(0,K.jsxs)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:[n.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,n.verification!==`unverified`&&(0,K.jsxs)(`span`,{className:V(`rounded px-1.5 py-0.5`,n.verification===`passed`?`bg-success/10 text-success`:n.verification===`failed`?`bg-destructive/10 text-destructive`:`bg-warning/10 text-warning`),children:[`✓ `,n.verification]}),n.subtaskCounts&&(0,K.jsxs)(`span`,{className:`rounded bg-info/10 px-1.5 py-0.5 text-info`,children:[n.subtaskCounts.done,`/`,n.subtaskCounts.total,` subtasks`]}),n.evidenceCount>0&&(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground`,children:[n.evidenceCount,` evidence`]}),n.pendingDecomposition&&(0,K.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:l(`activity:kanban.splitPendingApproval`)})]})]},t.id)})})]})}var Zt=`task:`;function Qt(e){return`${Zt}${e}`}function $t(e,t){let n=[],r=e.tasks.find(e=>e.id===t);return r?e.lifecycle?.mode===`managed`?(r.description?.trim()||n.push({code:`task-description-missing`,field:`description`,message:`Add a complete task description.`}),[r.assignee,r.assignedAgent,r.assignment?.agentId,r.assignment?.name].some(e=>e?.trim())||n.push({code:`task-owner-missing`,field:`assignee`,message:`Assign an owner or agent.`}),(!r.successCriteria?.length||r.successCriteria.some(e=>!e.description.trim()))&&n.push({code:`success-criteria-missing`,field:`successCriteria`,message:`Add at least one explicit, executable acceptance criterion.`}),r.atomic&&!r.childTaskIds?.some(e=>e.trim())&&n.push({code:`task-child-tasks-missing`,field:`childTaskIds`,message:`Break the work into at least one persisted subtask.`}),{taskId:t,ready:n.length===0,issues:n}):{taskId:t,ready:!0,issues:[]}:{taskId:t,ready:!1,issues:[{code:`task-not-found`,field:`taskId`,message:`Kanban task not found: ${t}`}]}}function en(e,t,n){let r=e.contractGraph,i=r?.enforcement??`off`;if(!r||i===`off`)return{taskId:t,enforcement:i,allowed:!0,evaluatedNodeIds:[],issues:[]};let a=rn(r,Qt(t),t),o=r.nodes.filter(e=>a.has(e.id)),s=[],c=r=>r===t&&n?n:e.tasks.find(e=>e.id===r),l=o.filter(e=>e.kind===`objective`),u=o.filter(e=>e.kind===`guardrail`);l.length===0&&s.push({code:`objective-missing`,message:`Contract graph requires an objective.`}),u.length===0&&s.push({code:`guardrail-missing`,message:`Contract graph requires at least one guardrail.`});let d=new Map;for(let e of o){let t=nn(e,c(e.taskId),s);d.set(e.id,t),e.enforcement===`blocking`&&e.kind!==`component`&&e.kind!==`artifact`&&(t===`satisfied`||t===`resolved`||t===`waived`&&tn(e)||s.push({code:t===`waived`?`waiver-invalid`:`node-unresolved`,nodeId:e.id,message:`Blocking ${e.kind} "${e.title}" is ${t}.`}))}let f=o.filter(e=>e.kind===`risk`);for(let e of[...l,...u,...f].filter(e=>e.enforcement===`blocking`)){let t=!!(e.checkId||e.metricId),n=r.edges.some(t=>{if(t.from!==e.id||t.type!==`verified_by`||!a.has(t.to))return!1;let n=r.nodes.find(e=>e.id===t.to&&e.kind===`verification`),i=n?d.get(n.id):void 0;return!!(n&&(n.checkId||n.metricId)&&(i===`satisfied`||i===`resolved`||i===`waived`&&tn(n)))});!t&&!n&&s.push({code:`verification-missing`,nodeId:e.id,message:`Blocking ${e.kind} "${e.title}" has no check, metric, or verified_by evidence.`})}for(let e of r.edges)e.type===`conflicts_with`&&e.enforcement===`blocking`&&(!a.has(e.from)&&!a.has(e.to)||[d.get(e.from),d.get(e.to)].every(e=>e===`satisfied`||e===`resolved`||e===`waived`)||s.push({code:`conflict-unresolved`,edgeId:e.id,message:`Blocking conflict ${e.from} -> ${e.to} is unresolved.`}));return{taskId:t,enforcement:i,allowed:i!==`strict`||s.length===0,evaluatedNodeIds:o.map(e=>e.id),issues:s}}function tn(e){let t=e.waiver;return!t?.actor.trim()||!t.reason.trim()||!t.at.trim()?!1:!t.expiresAt||Date.parse(t.expiresAt)>Date.now()}function nn(e,t,n){if(!t)return n.push({code:`binding-invalid`,nodeId:e.id,message:`Contract node owner task not found: ${e.taskId}`}),`violated`;if(e.checkId){let r=t.successCriteria?.find(t=>t.id===e.checkId);return r?r.status===`passed`?`satisfied`:r.status===`failed`?`violated`:e.state===`waived`?`waived`:`active`:(n.push({code:`binding-invalid`,nodeId:e.id,message:`Bound check not found: ${e.checkId}`}),`violated`)}if(e.metricId){let r=t.goalMetrics?.find(t=>t.id===e.metricId);return r?r.status===`met`?`satisfied`:r.status===`missed`?`violated`:r.status===`waived`?e.waiver?`waived`:`violated`:`active`:(n.push({code:`binding-invalid`,nodeId:e.id,message:`Bound metric not found: ${e.metricId}`}),`violated`)}return e.kind===`verification`&&e.enforcement===`blocking`&&n.push({code:`verification-missing`,nodeId:e.id,message:`Blocking verification "${e.title}" is not bound to an executable check.`}),e.state}function rn(e,t,n){let r=new Set(e.nodes.filter(e=>e.taskId===n).map(e=>e.id)),i=[t,...r],a=new Set(i);for(;i.length;){let t=i.shift();if(t)for(let n of e.edges){let e=n.from===t?n.to:(n.type===`conflicts_with`||n.type===`relates_to`)&&n.to===t?n.from:void 0;!e||a.has(e)||(a.add(e),i.push(e),e.startsWith(Zt)||r.add(e))}}return r}var an={objective:300,component:590,artifact:590,risk:880,guardrail:880,verification:1170},on={objective:`#38bdf8`,component:`#818cf8`,artifact:`#f472b6`,risk:`#fb923c`,guardrail:`#34d399`,verification:`#c084fc`},sn={objective:320,component:620,artifact:620,risk:920,guardrail:920,verification:1220},cn={objective:0,component:1,artifact:1,risk:2,guardrail:2,verification:3},ln={targets:`#38bdf8`,affects:`#818cf8`,must_preserve:`#34d399`,exposes:`#fb923c`,verified_by:`#c084fc`,conflicts_with:`#fb7185`,derived_from:`#94a3b8`,relates_to:`#67e8f9`};function un(e){let t=e.contractGraph,n={objective:0,guardrail:0,risk:0,component:0,artifact:0,verification:0};for(let e of t?.nodes??[])n[e.kind]+=1;let r=e.tasks.map(n=>{let r=t?.nodes.filter(e=>e.taskId===n.id)??[],i=en(e,n.id),a=$t(e,n.id);return{taskId:n.id,title:n.title,contracted:r.length>0,ready:a.ready,closed:r.length>0&&i.issues.length===0,nodeCount:r.length,issueCount:i.issues.length,issueMessages:i.issues.map(e=>e.message),readinessIssueCount:a.issues.length,readinessIssueMessages:a.issues.map(e=>e.message)}}),i=r.length,a=r.filter(e=>e.contracted).length,o=r.filter(e=>e.ready).length,s=r.filter(e=>e.closed).length;return{enforcement:t?.enforcement??`off`,totalTasks:i,contractedTasks:a,readyTasks:o,closedTasks:s,openTasks:r.filter(e=>!e.closed).length,openIssues:r.reduce((e,t)=>e+t.issueCount,0),readinessIssues:r.reduce((e,t)=>e+t.readinessIssueCount,0),blockingNodes:t?.nodes.filter(e=>e.enforcement===`blocking`).length??0,evidenceNodes:t?.nodes.filter(e=>e.kind===`verification`||!!(e.checkId||e.metricId)).length??0,coveragePct:i===0?100:a/i*100,closurePct:i===0?100:s/i*100,tasks:r,nodesByKind:n}}function dn(e){let t=e.contractGraph,n=new Map(un(e).tasks.map(e=>[e.taskId,e])),r=new Set(e.tasks.flatMap(t=>en(e,t.id).issues.flatMap(e=>e.nodeId?[e.nodeId]:[]))),i=new Map,a=0;for(let n of e.tasks){let e=new Map;for(let r of t?.nodes.filter(e=>e.taskId===n.id)??[]){let t=cn[r.kind];e.set(t,(e.get(t)??0)+1)}let r=Math.max(1,...e.values()),o=Math.max(190,r*104+54);i.set(n.id,{top:a,height:o}),a+=o}let o=e.tasks.map(e=>{let t=n.get(e.id),r=t?.contracted?t.ready?t.closed?`#34d399`:`#38bdf8`:`#fb7185`:`#fb923c`,a=i.get(e.id)??{top:0,height:190};return{id:Qt(e.id),position:{x:0,y:a.top+(a.height-72)/2},data:{label:`${e.title}\n${t?.contracted?`${t.ready?`START READY`:`${t.readinessIssueCount} setup gaps`} · ${t.issueCount} completion open`:`contract missing`}`,color:r},style:mn(r,!0)}}),s=new Map;for(let e of t?.nodes??[]){let t=`${e.taskId}:${cn[e.kind]}`,n=s.get(t)??0;s.set(t,n+1);let a=r.has(e.id)?`#fb7185`:on[e.kind],c=i.get(e.taskId)??{top:0,height:190};o.push({id:e.id,position:{x:sn[e.kind],y:c.top+26+n*104},data:{label:`${e.kind.toUpperCase()} · ${e.title}\n${e.state} · ${e.enforcement}`,color:a},style:mn(a)})}let c=new Set(o.map(e=>e.id));return{nodes:o,edges:t?.edges.filter(e=>c.has(e.from)&&c.has(e.to)).map(e=>pn(e))??[]}}function fn(e,t,n){let r=e.contractGraph,i=new Set(n),a=r?.nodes.filter(e=>i.has(e.id))??[],o=new Map,s=new Map;for(let e of a){let t=cn[e.kind];s.set(t,(s.get(t)??0)+1)}let c=Math.max(1,...s.values()),l=[{id:Qt(t.id),position:{x:0,y:Math.max(36,(c-1)*108/2)},data:{label:t.title,color:`#0ea5e9`},style:mn(`#0ea5e9`,!0)}];for(let e of a){let t=cn[e.kind],n=o.get(t)??0;o.set(t,n+1),l.push({id:e.id,position:{x:an[e.kind],y:n*108},data:{label:`${e.kind.toUpperCase()} · ${e.title}\n${e.state} · ${e.enforcement}`,color:on[e.kind]},style:mn(on[e.kind])})}let u=new Set(l.map(e=>e.id));return{nodes:l,edges:r?.edges.filter(e=>u.has(e.from)&&u.has(e.to)).map(e=>pn(e))??[]}}function pn(e){let t=ln[e.type];return{id:e.id,source:e.from,target:e.to,label:e.type.replaceAll(`_`,` `),animated:e.type===`verified_by`,style:{stroke:t,strokeWidth:e.enforcement===`blocking`?2.4:1.5,opacity:e.enforcement===`blocking`?1:.72},markerEnd:{type:oe.ArrowClosed,color:t,width:16,height:16},labelStyle:{fontSize:10,fontWeight:600,fill:`#cbd5e1`},labelBgStyle:{fill:`#07101f`,fillOpacity:.9},labelBgPadding:[5,3],labelBgBorderRadius:5}}function mn(e,t=!1){return{width:220,minHeight:64,border:`1.5px solid ${e}`,borderRadius:12,background:t?`linear-gradient(135deg, ${e}, #075985)`:`${e}24`,color:`#f8fafc`,boxShadow:`0 10px 30px ${e}18, inset 0 1px 0 rgba(255,255,255,0.08)`,fontSize:11,fontWeight:650,lineHeight:1.45,whiteSpace:`pre-line`,padding:11}}var hn=[{kind:`objective`,label:`Objective`,color:`bg-blue-500`},{kind:`component`,label:`Affected component`,color:`bg-slate-500`},{kind:`artifact`,label:`Artifact`,color:`bg-slate-400`},{kind:`risk`,label:`Risk`,color:`bg-amber-500`},{kind:`guardrail`,label:`Guardrail`,color:`bg-emerald-500`},{kind:`verification`,label:`Evidence`,color:`bg-violet-500`}];function gn({icon:e,label:t,value:n,detail:r,tone:i}){return(0,K.jsxs)(`div`,{className:`group relative overflow-hidden rounded-xl border border-border/70 bg-card/80 p-3 shadow-sm backdrop-blur-sm`,children:[(0,K.jsx)(`div`,{className:V(`absolute -right-5 -top-6 h-16 w-16 rounded-full blur-2xl transition-opacity group-hover:opacity-90`,i===`primary`&&`bg-primary/25`,i===`success`&&`bg-success/25`,i===`warning`&&`bg-warning/25`,i===`danger`&&`bg-destructive/25`)}),(0,K.jsxs)(`div`,{className:`relative flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:t}),(0,K.jsx)(`div`,{className:`mt-1 text-2xl font-bold tabular-nums`,children:n}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:r})]}),(0,K.jsx)(`span`,{className:`rounded-lg border bg-background/70 p-2 text-muted-foreground shadow-sm`,children:(0,K.jsx)(e,{size:15})})]})]})}function _n({graph:e,nodeOwner:n,onSelectTask:r,expanded:i,onExpand:a}){return(0,K.jsxs)(`div`,{"data-contract-board-canvas":i?`expanded`:`embedded`,className:V(`relative overflow-hidden bg-[#07101f]`,i?`h-full min-h-0 w-full`:`h-[72vh] min-h-[680px] max-h-[880px] rounded-2xl border shadow-xl shadow-black/10`),children:[(0,K.jsxs)(`div`,{className:`pointer-events-none absolute left-4 top-3 z-10 rounded-lg border border-white/10 bg-black/40 px-3 py-2 backdrop-blur`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold text-slate-100`,children:[(0,K.jsx)(C,{size:13,className:`text-cyan-300`}),` Live dependency field`]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[9px] text-slate-400`,children:`Drag canvas to pan · use wheel or controls to zoom`})]}),a&&(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:`absolute right-4 top-3 z-10 inline-flex items-center gap-2 rounded-lg border border-cyan-300/25 bg-slate-950/85 px-3 py-2 text-[11px] font-semibold text-cyan-200 shadow-xl backdrop-blur transition-colors hover:border-cyan-300/50 hover:bg-slate-900`,"aria-label":`Expand board Contract Map`,children:[(0,K.jsx)(t,{size:13}),` Expand map`]}),(0,K.jsxs)(ie,{nodes:e.nodes,edges:e.edges,fitView:!0,fitViewOptions:{padding:i?.1:.16,maxZoom:i?1.15:1.05},minZoom:.1,maxZoom:1.7,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,panOnDrag:!0,onNodeClick:(e,t)=>{let i=t.id.startsWith(`task:`)?t.id.slice(5):n.get(t.id);i&&r(i)},proOptions:{hideAttribution:!0},children:[(0,K.jsx)(_e,{variant:le.Dots,gap:24,size:1.2,color:`#22314a`}),(0,K.jsx)(ne,{pannable:!0,zoomable:!0,nodeColor:e=>String(e.data.color??`#64748b`),maskColor:`rgba(2, 6, 23, 0.72)`,className:`!border !border-white/10 !bg-slate-950/80`}),(0,K.jsx)(ee,{showInteractive:!1,className:`!overflow-hidden !rounded-lg !border !border-white/10 !bg-slate-950/80 !shadow-xl [&_button]:!border-slate-700 [&_button]:!bg-slate-900 [&_button]:!fill-slate-200`})]})]})}function vn({board:e,onSelectTask:t}){let[n,r]=(0,U.useState)(!1),i=(0,U.useMemo)(()=>un(e),[e.id,e.revision]),a=(0,U.useMemo)(()=>dn(e),[e.id,e.revision]),o=(0,U.useMemo)(()=>new Map(e.contractGraph?.nodes.map(e=>[e.id,e.taskId])??[]),[e.id,e.revision]),s=i.enforcement===`strict`,c=i.openTasks===0&&i.totalTasks>0;return(0,K.jsxs)(`div`,{className:`h-full overflow-y-auto bg-[radial-gradient(circle_at_top_left,hsl(var(--primary)/0.08),transparent_34%),radial-gradient(circle_at_top_right,hsl(var(--info)/0.08),transparent_28%)] p-4`,children:[(0,K.jsxs)(`section`,{className:`relative overflow-hidden rounded-2xl border border-primary/20 bg-gradient-to-br from-card via-card to-primary/5 p-4 shadow-lg shadow-primary/5`,children:[(0,K.jsx)(`div`,{className:`pointer-events-none absolute -right-20 -top-24 h-64 w-64 rounded-full bg-primary/10 blur-3xl`}),(0,K.jsx)(`div`,{className:`pointer-events-none absolute -bottom-28 left-1/3 h-56 w-56 rounded-full bg-info/10 blur-3xl`}),(0,K.jsxs)(`div`,{className:`relative flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,K.jsxs)(`div`,{className:`relative hidden h-14 w-14 shrink-0 items-center justify-center rounded-2xl border border-primary/30 bg-primary/10 text-primary shadow-inner sm:flex`,children:[(0,K.jsx)(z,{size:28}),(0,K.jsx)(`span`,{className:`absolute right-1 top-1 h-2 w-2 animate-pulse rounded-full bg-success shadow-[0_0_10px_hsl(var(--success))]`})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`text-base font-bold tracking-tight`,children:`Contract Map`}),(0,K.jsx)(`span`,{className:V(`rounded-full border px-2 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-wider`,s?`border-success/30 bg-success/10 text-success`:`border-warning/30 bg-warning/10 text-warning`),children:i.enforcement}),c&&(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[10px] font-semibold text-success`,children:[(0,K.jsx)(w,{size:11}),` all contracts closed`]})]}),(0,K.jsx)(`p`,{className:`mt-1 max-w-3xl text-xs leading-5 text-muted-foreground`,children:`The board's objective, blast radius, risks, invariants, and evidence chain. Red paths demand attention; animated links carry verification evidence.`})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-4 rounded-xl border border-border/70 bg-background/60 px-4 py-2 backdrop-blur`,children:[(0,K.jsx)(Re,{pct:i.closurePct}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-xs font-semibold`,children:`Safety closure`}),(0,K.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[i.closedTasks,`/`,i.totalTasks,` task contracts closed`]}),(0,K.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(N,{size:10}),` coverage `,Math.round(i.coveragePct),`%`]})]})]})]})]}),(0,K.jsxs)(`section`,{className:`mt-3 grid grid-cols-2 gap-2 lg:grid-cols-5`,children:[(0,K.jsx)(gn,{icon:C,label:`Mapped tasks`,value:`${i.contractedTasks}/${i.totalTasks}`,detail:`${Math.round(i.coveragePct)}% contract coverage`,tone:`primary`}),(0,K.jsx)(gn,{icon:N,label:`Start ready`,value:`${i.readyTasks}/${i.totalTasks}`,detail:`${i.readinessIssues} setup gaps`,tone:i.readyTasks===i.totalTasks?`success`:`warning`}),(0,K.jsx)(gn,{icon:D,label:`Closed`,value:i.closedTasks,detail:`objectives and guardrails proven`,tone:`success`}),(0,K.jsx)(gn,{icon:y,label:`Open issues`,value:i.openIssues,detail:`${i.openTasks} tasks need attention`,tone:i.openIssues>0?`danger`:`success`}),(0,K.jsx)(gn,{icon:_,label:`Evidence`,value:i.evidenceNodes,detail:`${i.blockingNodes} blocking nodes`,tone:i.evidenceNodes>0?`primary`:`warning`})]}),(0,K.jsxs)(`section`,{className:`mt-3 grid min-h-[560px] gap-3 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,K.jsx)(_n,{graph:a,nodeOwner:o,onSelectTask:t,expanded:!1,onExpand:()=>r(!0)}),(0,K.jsxs)(`aside`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`rounded-xl border bg-card/80 shadow-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b px-3 py-2 text-xs font-semibold`,children:[(0,K.jsx)(m,{size:14,className:i.openTasks?`text-warning`:`text-success`}),`Task contract status`]}),(0,K.jsx)(`div`,{className:`max-h-72 divide-y overflow-y-auto`,children:[...i.tasks].sort((e,t)=>Number(e.closed)-Number(t.closed)).map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e.taskId),className:`flex w-full items-start gap-2 px-3 py-2.5 text-left hover:bg-muted/40`,children:[e.closed?(0,K.jsx)(u,{size:14,className:`mt-0.5 shrink-0 text-success`}):e.ready?(0,K.jsx)(N,{size:14,className:`mt-0.5 shrink-0 text-primary`}):(0,K.jsx)(m,{size:14,className:`mt-0.5 shrink-0 text-warning`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-xs font-medium`,children:e.title}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-[10px] text-muted-foreground`,children:e.contracted?`${e.ready?`start ready`:`${e.readinessIssueCount} setup gaps`} · ${e.issueCount} completion open`:`No contract nodes — objective and guardrail missing`})]})]},e.taskId))})]}),(0,K.jsxs)(`div`,{className:`rounded-xl border bg-card/80 p-3 shadow-sm`,children:[(0,K.jsx)(`div`,{className:`mb-2 text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:`Contract vocabulary`}),(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:hn.map(e=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px]`,children:[(0,K.jsx)(`span`,{className:V(`h-2.5 w-2.5 rounded-sm shadow-sm`,e.color)}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,K.jsx)(`span`,{className:`ml-auto font-mono text-muted-foreground`,children:i.nodesByKind[e.kind]})]},e.kind))})]}),!s&&(0,K.jsxs)(`div`,{className:`rounded-xl border border-warning/30 bg-warning/5 p-3 text-[11px] leading-5 text-warning`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold`,children:[(0,K.jsx)(y,{size:14}),` Strict enforcement is not active`]}),(0,K.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Autonomous coding boards should use strict contracts so unresolved guardrails block Done instead of becoming advisory metadata.`})]})]})]}),(0,K.jsx)(je,{open:n,onOpenChange:r,children:(0,K.jsxs)(ke,{"aria-describedby":`board-contract-map-modal-description`,className:`flex h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-[calc(100vw-2rem)] flex-col gap-0 overflow-hidden border-white/10 bg-[#07101f] p-0 text-slate-100 sm:p-0`,children:[(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-white/10 bg-slate-950/90 px-5 py-4 pr-14 text-slate-100`,children:[(0,K.jsxs)(Ae,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(C,{size:17,className:`text-cyan-300`}),` Contract Map · `,e.title]}),(0,K.jsx)(H,{id:`board-contract-map-modal-description`,className:`mt-1 text-xs text-slate-400`,children:`Full-board dependency field · drag to pan, use wheel or controls to zoom, click a node to inspect its task.`})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(_n,{graph:a,nodeOwner:o,onSelectTask:t,expanded:!0})})]})})]})}function yn({board:e,sendKanban:t,onSelectTask:r}){let{t:i}=n(),[a,o]=(0,U.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)(I,{size:13}):(0,K.jsx)(M,{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(n=>(0,K.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(n.id),className:`min-w-0 flex-1 truncate text-left hover:underline`,children:[n.title,(0,K.jsxs)(`span`,{className:`ml-1.5 text-muted-foreground`,children:[`→ `,n.decomposition?.proposedSubtasks.length??0,` subtasks`]})]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(`kanban.decomposition.approve`,{boardId:e.id,taskId:n.id,proposalId:n.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)(P,{size:12}),` `,i(`activity:kanbanDecomp.approve`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(`kanban.decomposition.reject`,{boardId:e.id,taskId:n.id,proposalId:n.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`)]})]},n.id))})]}):null}var bn=[`assessed`,`proposed`,`approval`,`applied`];function xn(e){let t=e.decomposition?.status;return t===`applied`?3:t===`approved`||t===`rejected`?2:t===`proposed`?1:e.atomicityAssessment?0:-1}function Sn({board:e,task:t,sendKanban:r,onSelectTask:i}){let{t:a}=n(),o=t.decomposition,s=xn(t),c=(0,U.useMemo)(()=>{if(!o)return null;let n=(o.appliedChildTaskIds??[]).map(t=>e.tasks.find(e=>e.id===t)).filter(e=>!!e);return{tasks:[{id:t.id,shortId:`parent`,title:t.title,displayStatus:o.status===`applied`?`completed`:`in_progress`,priority:t.priority,deps:[]},...o.proposedSubtasks.map((e,r)=>{let i=n[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:t.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:n}},[e,o,t]);return!o&&!t.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:[bn.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:V(`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)),t.atomicityAssessment&&(0,K.jsxs)(`span`,{className:`ml-auto text-muted-foreground`,children:[t.atomicityAssessment.verdict,` · score `,t.atomicityAssessment.score]})]}),!o&&t.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:t.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)(Le,{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:t.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)(P,{size:13}),` `,a(`activity:kanbanDecomp.approveAmpSplit`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(`kanban.decomposition.reject`,{boardId:e.id,taskId:t.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]})]})]})}function Cn(e){return[{code:`stale_assignments`,count:e.staleAssignments.count},{code:`failed`,count:e.counts.failed},{code:`blocked`,count:e.counts.blocked},{code:`failed_retryable`,count:e.failedRetryable.count},{code:`dependency_blocked`,count:e.dependencyBlocked.count},{code:`heartbeat_due`,count:e.heartbeatDue.count}].filter(e=>e.count>0)}function wn(e){return Cn(e).length>0}function Tn({queueHealth:e,runningCostTotal:t}){let{t:r}=n();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:r(`activity:kanban.queueHealth`)}),e.counts.startable>0&&(0,K.jsxs)(`span`,{title:r(`activity:kanban.claimableTasks`),className:`inline-flex items-center gap-1 text-success`,children:[e.counts.startable,` `,r(`activity:kanban.statusReady`)]}),e.counts.running>0&&(0,K.jsxs)(`span`,{title:r(`activity:kanban.runningAssignments`),className:`inline-flex items-center gap-1 text-warning`,children:[e.counts.running,` `,r(`activity:kanban.statusRunning`)]}),e.counts.review>0&&(0,K.jsxs)(`span`,{title:r(`activity:kanban.inReview`),className:`inline-flex items-center gap-1 text-primary`,children:[e.counts.review,` `,r(`activity:kanban.statusReview`)]}),e.counts.blocked>0&&(0,K.jsxs)(`span`,{title:r(`activity:kanban.manuallyBlocked`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.blocked,` `,r(`activity:kanban.statusBlocked`)]}),e.counts.failed>0&&(0,K.jsxs)(`span`,{title:r(`activity:kanban.failedTasks`),className:`inline-flex items-center gap-1 text-destructive`,children:[e.counts.failed,` `,r(`activity:kanban.statusFailed`)]}),e.dependencyBlocked.count>0&&(0,K.jsxs)(`span`,{title:r(`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,` `,r(`activity:kanban.statusBlockedByDeps`)]}),e.staleAssignments.count>0&&(0,K.jsxs)(`span`,{title:r(`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,` `,r(`activity:kanban.statusStale`)]}),!wn(e)&&(0,K.jsx)(`span`,{className:`text-success`,children:r(`activity:kanban.healthy`)}),t>0&&(0,K.jsx)(`span`,{title:r(`activity:kanban.costCeilingSum`),className:`inline-flex items-center gap-1 text-info`,children:r(`activity:kanban.runningCost`,{cost:t.toFixed(2)})})]})}function En({runLink:e,sendRaw:t}){let{t:r}=n(),a=e.engine===`sdd`,s=a?`sdd.board`:`goal`,c=Oe(e=>e.setCurrentView),l=(n,r={})=>t(n,e.runId?{runId:e.runId,...r}:r),u=`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)(se,{size:11}),` `,e.engine]}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r(`activity:kanban.liveRunSteer`)}),a&&(0,K.jsxs)(`button`,{type:`button`,className:u,title:r(`activity:kanban.openLiveRun`),onClick:()=>c(`sddhub`),children:[(0,K.jsx)(se,{size:12}),` `,r(`activity:kanban.openLiveRun`)]}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsxs)(`button`,{type:`button`,className:u,onClick:()=>l(`${s}.pause`),children:[(0,K.jsx)(de,{size:12}),` `,r(`activity:kanban.actionPause`)]}),(0,K.jsxs)(`button`,{type:`button`,className:u,onClick:()=>l(`${s}.resume`),children:[(0,K.jsx)(o,{size:12}),` `,r(`activity:kanban.actionResume`)]}),a&&(0,K.jsxs)(`button`,{type:`button`,className:u,onClick:()=>l(`sdd.board.retry_all_failed`),children:[(0,K.jsx)(me,{size:12}),` `,r(`activity:kanban.actionRetryFailed`)]}),(0,K.jsxs)(`button`,{type:`button`,className:V(u,`text-destructive hover:bg-destructive/10`),onClick:()=>l(`${s}.stop`),children:[(0,K.jsx)(i,{size:12}),` `,r(`activity:kanban.actionStop`)]})]})]})}function Dn({boardId:e,sendKanban:t}){let{t:r}=n(),i=`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)(se,{size:13,className:`text-primary`}),(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:r(`activity:kanban.runAsLiveJob`)}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,className:i,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`goal`}),children:r(`activity:kanban.startAsGoal`)}),(0,K.jsx)(`button`,{type:`button`,className:i,onClick:()=>t(`kanban.run.start`,{boardId:e,engine:`sdd`}),children:r(`activity:kanban.startAsSdd`)})]})]})}function On({runLink:e,runTaskId:t,modelCandidates:r,sendRaw:a}){let{t:s}=n(),c=e.engine===`sdd`,[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(``),p=(t,n={})=>a(t,e.runId?{runId:e.runId,...n}:n),m=`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=d.trim();e&&(p(c?`sdd.board.reassign`:`goal.assignTask`,{taskId:t,agentName:e}),u(!1),f(``))};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:s(`activity:kanban.runControls`)}),c&&(0,K.jsxs)(`div`,{className:`mb-2`,children:[(0,K.jsx)(`div`,{className:`mb-1 text-[10px] uppercase text-muted-foreground`,children:s(`activity:kanban.workerModel`)}),(0,K.jsx)(Ne,{candidates:r,placeholder:s(`activity:kanban.setModelForTask`),onPick:(e,n)=>p(`sdd.board.set_task_model`,{taskId:t,model:e,provider:n})})]}),l?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h(),e.key===`Escape`&&u(!1)},placeholder:s(`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)(P,{size:14})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>u(!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:m,onClick:()=>p(c?`sdd.board.retry`:`goal.retryTask`,{taskId:t}),children:[(0,K.jsx)(me,{size:13}),` `,s(`common:action.retry`)]}),(0,K.jsxs)(`button`,{type:`button`,className:m,onClick:()=>u(!0),children:[(0,K.jsx)(b,{size:13}),` `,s(`activity:kanban.actionReassign`)]}),c?(0,K.jsxs)(`button`,{type:`button`,className:V(m,`text-destructive hover:bg-destructive/10`),onClick:()=>p(`sdd.board.cancel_task`,{taskId:t}),children:[(0,K.jsx)(i,{size:13}),` `,s(`common:action.cancel`)]}):(0,K.jsxs)(`button`,{type:`button`,className:m,onClick:()=>p(`goal.runTask`,{taskId:t}),children:[(0,K.jsx)(o,{size:13}),` `,s(`activity:kanban.actionRunNow`)]})]})]})}var kn={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 An(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 jn({assignment:e}){let{t}=n(),r=e.status===`running`,i=An(e.dispatchedAt,e.completedAt),a=q(e.name)??q(e.agentId),o=q(e.role),s=q(e.provider),c=q(e.model),l=[];return a&&l.push({label:t(`activity:kanbanRun.agent`),value:a}),o&&l.push({label:t(`activity:kanbanRun.role`),value:o}),e.modelRouting&&l.push({label:t(`activity:kanbanRun.modelSource`),value:e.modelRouting}),(s||c)&&l.push({label:t(`activity:kanbanRun.model`),value:(0,K.jsxs)(`span`,{className:`font-mono text-[11px]`,children:[s?`${s}/`:``,c??`—`]})}),e.subagentId&&l.push({label:t(`activity:kanban.subagent`),value:(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.subagentId})}),i&&l.push({label:e.completedAt?t(`activity:kanban.duration`):t(`activity:kanban.elapsed`),value:i}),typeof e.attempt==`number`&&l.push({label:t(`activity:kanbanRun.attempt`),value:`${e.attempt}${e.maxAttempts?` / ${e.maxAttempts}`:``}`}),e.costCeilingUsd&&l.push({label:t(`activity:kanbanRun.costCeiling`),value:`$${e.costCeilingUsd.toFixed(2)}`}),e.fallbackProfile&&l.push({label:t(`activity:kanbanRun.fallbackProfile`),value:e.fallbackProfile}),e.fallbackModels?.length&&l.push({label:t(`activity:kanbanRun.fallbacks`),value:e.fallbackModels.join(` → `)}),e.skills?.length&&l.push({label:t(`activity:kanbanRun.skills`),value:e.skills.join(`, `)}),e.tools?.length&&l.push({label:t(`activity:kanbanRun.tools`),value:e.tools.join(`, `)}),e.leaseExpiresAt&&l.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:V(`ml-auto inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,kn[e.status]??`bg-muted text-muted-foreground`),children:[r&&(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current`,"aria-hidden":!0}),e.status]})]}),l.length>0&&(0,K.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:l.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 Mn({activityKind:e,activityOutcome:t,note:r,details:i,onActivityKindChange:a,onActivityOutcomeChange:o,onNoteChange:s,onDetailsChange:c,onRecordActivity:l}){let{t:u}=n();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:r,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)(S,{size:14})})]}),(0,K.jsx)(`input`,{value:i,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 Nn({board:e,task:t,newCheck:r,onNewCheckChange:i,onAddCheck:a,sendKanban:o}){let{t:s}=n();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:s(`activity:kanbanTaskCompletionChecks.completionChecks`)}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(t.successCriteria??[]).map(n=>(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)(P,{size:13,className:n.status===`passed`?`text-success`:`text-muted-foreground`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:n.description}),(0,K.jsx)(`select`,{value:n.status,onChange:r=>o(`kanban.task.check.update`,{boardId:e?.id,taskId:t.id,checkId:n.id,status:r.target.value}),className:`h-7 rounded border bg-background px-1 text-[11px]`,children:[`pending`,`passed`,`failed`,`skipped`].map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]},n.id)),(0,K.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,K.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&a(),placeholder:s(`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:a,className:`h-8 rounded-md border px-2 hover:bg-muted`,children:(0,K.jsx)(S,{size:14})})]})]})]})}var Pn=[{key:`definition`,icon:v,labelKey:`activity:kanbanInspector.tabDefinition`},{key:`execution`,icon:o,labelKey:`activity:kanbanInspector.tabExecution`},{key:`evidence`,icon:D,labelKey:`activity:kanbanInspector.tabEvidence`},{key:`breakdown`,icon:_,labelKey:`activity:kanbanInspector.tabBreakdown`},{key:`history`,icon:ce,labelKey:`activity:kanbanInspector.tabHistory`}];function Fn(e,t){return!e||!t.dependsOn?.length?[]:t.dependsOn.flatMap(t=>{let n=e.tasks.find(e=>e.id===t);return n?n.status===`completed`?[]:[n.title]:[`${t.slice(0,8)} (missing)`]})}function In(e,t,n){let r=t.childTaskIds?.length??0,i=t.successCriteria?.length??0,a=t.assignment?.attempt??0;return{...a>1?{execution:a}:{},...i>0?{evidence:i}:{},...r>0?{breakdown:r}:{},...n>0?{history:n}:{}}}var Ln={in_progress:`bg-warning/15 text-warning`,review:`bg-info/15 text-info`,completed:`bg-success/15 text-success`,blocked:`bg-destructive/15 text-destructive`,failed:`bg-destructive/15 text-destructive`};function Rn({task:e,blockedBy:t,columnLabel:n,expanded:r,blockedLabel:i,regionLabel:a}){let o=[n,e.priority,...e.assignment?.agentId?[e.assignment.agentId]:[],...e.atomic?[`atomic`]:[]];return(0,K.jsxs)(`section`,{"aria-label":a,className:V(`border-b px-3 py-2`,r&&`px-5 xl:px-7`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:V(`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,Ln[e.status]??`bg-muted text-muted-foreground`),children:e.status}),o.map(e=>(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e},e))]}),t.length>0&&(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 text-[11px] text-destructive`,children:[(0,K.jsx)(c,{size:13,className:`mt-px shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[i,` `,t.join(`; `)]})]})]})}function zn({active:e,onSelect:t,badges:n,labelFor:r,expanded:i}){return(0,K.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:V(`flex shrink-0 gap-0.5 overflow-x-auto border-b px-2`,i&&`px-4 xl:px-6`),children:Pn.map(({key:i,icon:a,labelKey:o})=>{let s=i===e,c=n[i];return(0,K.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":s,onClick:()=>t(i),className:V(`flex shrink-0 items-center gap-1.5 border-b-2 px-2.5 py-2 text-xs transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,s?`border-primary font-medium text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[(0,K.jsx)(a,{size:14,className:`shrink-0`}),(0,K.jsx)(`span`,{children:r(o)}),c!==void 0&&(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-[10px] text-muted-foreground`,children:c})]},i)})})}function Bn({expanded:e,rail:t,children:n}){return!e||!t?(0,K.jsx)(`div`,{className:`space-y-3`,children:n}):(0,K.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,K.jsx)(`div`,{className:`min-w-0 space-y-3`,children:n}),(0,K.jsx)(`div`,{className:`min-w-0 space-y-3 xl:border-l xl:pl-5`,children:t})]})}var Vn=[`architect`,`developer`,`reviewer`,`tester`,`verifier`,`security`,`documenter`,`external`,`leader`,`shadow`,`subagent`],Hn=[{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 Un(e,t,n,r=new Date().toISOString()){return{format:`wrongstack-kanban-task-activity`,version:1,exportedAt:r,scope:n,task:e,events:t}}function Wn(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Y(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function Gn(e){return e.type.startsWith(`task.file.`)?e.type===`task.file.read`?`execution`:`changes`:e.type.startsWith(`task.activity.`)?Y(Wn(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 Kn(e){let t=Wn(e.before),n=Wn(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 qn(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 Jn(e){let t=Wn(e.before),n=Wn(e.after);if(e.type.startsWith(`task.file.`)){let e=Y(n.filePath),t=Y(n.toolName),r=typeof n.durationMs==`number`?n.durationMs:void 0,i=typeof n.lines==`number`?n.lines:void 0;return[e,t?`tool:${t}`:void 0,r===void 0?void 0:`${r}ms`,i===void 0?void 0:`${i} lines`].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.activity.`))return[Y(n.outcome),Y(n.details)].filter(Boolean).join(` · `)||void 0;if(e.type===`task.moved`){let e=Y(t.columnId),r=Y(n.columnId);if(e||r)return`${e??`unknown`} → ${r??`unknown`}`}if(e.type===`task.updated`){let t=Kn(e);if(t.length)return`${t.length} field${t.length===1?``:`s`} changed: ${t.map(e=>e.field).join(`, `)}`}if(e.type===`task.lifecycle.transition`){let e=Y(t.stage),r=Y(n.stage);if(r)return e?`${e} → ${r}`:`Entered ${r}`}if(e.type===`task.assigned`||e.type===`task.assignment.snapshot`){let e=Y(n.name)??Y(n.agentId)??Y(n.role),t=Y(n.provider),r=Y(n.model);return[e,t||r?`${t?`${t}/`:``}${r??`default`}`:void 0].filter(Boolean).join(` · `)||void 0}if(e.type.startsWith(`task.check.`))return[Y(n.description),Y(n.status)].filter(Boolean).join(` · `)||void 0;if(e.type.startsWith(`task.metric.`))return[Y(n.name),Y(n.status)].filter(Boolean).join(` · `)||void 0}function Yn(e){let t=e.type;return Y(Wn(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 Xn(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 Zn(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 Qn(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 $n({event:e}){let t=Wn(e.after),n=Y(t.provider),r=Y(t.model),i=Y(t.modelRouting),a=Y(t.fallbackProfile),o=Array.isArray(t.fallbackModels)?t.fallbackModels.filter(e=>typeof e==`string`):[],s=typeof t.attempt==`number`?t.attempt:void 0,c=typeof t.maxAttempts==`number`?t.maxAttempts:void 0,l=Y(t.status);return!n&&!r&&!i&&!a&&!o.length&&s===void 0&&!l?null:(0,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 er({task:e,events:t,sessionId:r,loading:i=!1,error:a,onRefresh:o}){let{t:s}=n(),[c,l]=(0,U.useState)(`all`),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(!1),m=(0,U.useMemo)(()=>Qn(e,t,r),[e,t,r]),g=(0,U.useMemo)(()=>({all:m.length,execution:m.filter(e=>Gn(e)===`execution`).length,changes:m.filter(e=>Gn(e)===`changes`).length,notes:m.filter(e=>Gn(e)===`notes`).length,failures:m.filter(e=>Gn(e)===`failures`).length}),[m]),_=(0,U.useMemo)(()=>{let e=u.trim().toLowerCase();return m.filter(t=>c!==`all`&&Gn(t)!==c?!1:!e||[qn(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))},[m,c,u]),v=Ie(_,50,`${c}:${u}`),y=v.pageItems,b=[...new Set(m.map(e=>e.actor).filter(Boolean))].length,S=[...new Set(m.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)(h,{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:[_.length,`/`,m.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(Un(e,_,`filtered`),null,2)),p(!0)}catch{p(!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:f?(0,K.jsx)(P,{className:`size-3 text-success`}):(0,K.jsx)(x,{className:`size-3`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{let t=JSON.stringify(Un(e,m,`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)(be,{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)(B,{className:V(`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`,m.length],[`Actors`,b],[`Sessions`,S],[`Failures`,g.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:V(`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,` `,g[e]]},e))}),(0,K.jsxs)(`div`,{className:`relative mb-3`,children:[(0,K.jsx)(te,{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}),_.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:y.map(e=>{let t=Jn(e),n=e.sessionId??r,i=Kn(e),a=Gn(e)===`failures`,o=e.type.includes(`completed`)||Y(Wn(e.after).outcome)===`succeeded`;return(0,K.jsxs)(`li`,{className:`relative pb-4 pl-4 last:pb-0`,children:[(0,K.jsx)(`span`,{className:V(`absolute -left-[5px] top-1.5 size-2 rounded-full ring-4`,Yn(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:qn(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:Xn(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:V(`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:Zn(e.before)}),` `,(0,K.jsx)(`span`,{"aria-hidden":!0,children:`→`}),` `,(0,K.jsx)(`span`,{className:`text-foreground`,children:Zn(e.after)})]})]},e.field))}),(0,K.jsx)($n,{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)(Pe,{page:v.page,pageSize:v.pageSize,totalItems:v.totalItems,onPageChange:v.setPage,className:`mt-3`,itemLabel:`activity events`})]})]})}function tr(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`&&e.trim()?e.trim():void 0}function nr(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 rr(e,t){return X(t.status)||(e.type===`task.claimed`?`claimed`:e.type===`task.released`?`released`:e.type===`task.stale_recovered`?`recovered`:e.type.split(`.`).at(-1)??`unknown`)}function ir(e){return[`completed`,`failed`,`cancelled`,`released`,`recovered`].includes(e)}function ar(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 or(e,t,n){let r=Qn(e,t,n).filter(nr).sort((e,t)=>e.ts.localeCompare(t.ts)),i=new Map,a=0,o=0,s=!1;for(let e of r){let t=tr(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=rr(e,t),u=i.get(a)??{attempt:a,status:l,startedAt:e.ts,fallbackModels:[],sessionIds:new Set,eventCount:0};u.status=l,u.eventCount+=1,(e.sessionId??n)&&u.sessionIds.add(e.sessionId??n),u.owner=X(t.name)??X(t.agentId)??X(t.role)??e.actor??u.owner,u.provider=X(t.provider)??u.provider,u.model=X(t.model)??u.model,u.routingMode=X(t.modelRouting)??u.routingMode,u.fallbackProfile=X(t.fallbackProfile)??u.fallbackProfile,Array.isArray(t.fallbackModels)&&(u.fallbackModels=t.fallbackModels.filter(e=>typeof e==`string`)),u.subagentId=e.subagentId??X(t.subagentId)??u.subagentId,u.runTaskId=e.runTaskId??X(t.runTaskId)??u.runTaskId,l===`running`&&!u.runningAt&&(u.runningAt=e.ts),l===`completed`&&(u.result=X(t.lastResult)??e.note??u.result),(l===`failed`||l===`cancelled`)&&(u.error=X(t.error)??e.note??u.error),ir(l)&&(u.endedAt=e.ts),i.set(a,u),s=ir(l)}return[...i.values()].map(e=>({...e,sessionIds:[...e.sessionIds],durationMs:ar(e.startedAt,e.endedAt)})).sort((e,t)=>t.attempt-e.attempt)}function sr(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 cr(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 lr({task:e,events:t,sessionId:r}){let{t:i}=n(),a=or(e,t,r),o=Ie(a,8,e.id);return a.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)(ce,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:i(`activity:taskExecutionAttempts.executionAttempts`)}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground`,children:[a.length,` total`]}),(0,K.jsxs)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${cr(a[0].status)}`,children:[`latest:`,a[0].status]}),(0,K.jsx)(M,{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 ${cr(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)(f,{className:`size-3`}),` `,sr(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)(j,{className:`size-3`}),` `,e.owner??`Unknown agent`]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,K.jsx)(ae,{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:i(`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:i(`activity:taskExecutionAttempts.result`)}),` `,e.result]})]},e.attempt)),(0,K.jsx)(Pe,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,compact:!0,itemLabel:`execution attempts`})]})]}):null}function ur(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Z(e){return q(e)}function dr(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 fr(e,t,n,r,i,a,o){let s=Qn(t,n,r),c=dr(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=ur(s.find(e=>e.type===`task.assigned`||e.type===`task.claimed`||e.type.startsWith(`task.assignment.`))?.after),p=Z(u?.modelRouting)??Z(f.modelRouting)??`session`,m=Z(u?.provider)??Z(f.provider)??(p===`session`?Z(i):void 0),h=Z(u?.model)??Z(f.model)??(p===`session`?Z(a):void 0),g=(Array.isArray(u?.fallbackModels)?u.fallbackModels:Array.isArray(f.fallbackModels)?f.fallbackModels:[]).map(Z).filter(e=>e!==void 0),_=Z(u?.fallbackProfile)??Z(f.fallbackProfile),v=Z(u?.name)??Z(u?.agentId)??Z(u?.role)??Z(t.assignee)??Z(t.assignedAgent)??`Unassigned`,y=t.lifecycle?.history.at(-1),b=s.find(e=>e.note&&e.type!==`task.note.added`)?.note,x=`Placed in ${e.columns.find(e=>e.id===t.columnId)?.title??t.columnId}.`;u?.error?x=`Agent run failed: ${u.error}`:l.length?x=`Blocked by ${l.map(e=>e.title).join(`, `)}.`:y?.comment?x=y.comment:b?x=b:t.status===`review`?x=`Implementation is waiting for review evidence or approval.`:t.status===`in_progress`?x=`${v} is currently working on this task.`:t.status===`completed`&&(x=`The task and its current assignment are complete.`);let S=s.map(e=>Number(ur(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=>Gn(e)===`failures`),T=s.find(e=>e.type.includes(`completed`));return{column:e.columns.find(e=>e.id===t.columnId)?.title??t.columnId,reason:x,owner:v,routingMode:p,provider:m,model:h,primaryModel:m||h?`${m?`${m}/`:``}${h??`default`}`:`Session default`,fallbackRoute:[_?`profile:${_}`:``,...g].filter(Boolean).join(` → `)||`None configured`,blockers:l,dependencies:c,actors:[...new Set([...s.map(e=>e.actor).filter(e=>!!e),...d.map(e=>e.agentId)])],sessions:[...new Set([...s.map(e=>e.sessionId??r),...d.map(e=>e.sessionId)].filter(e=>!!e))],presence:d.map(e=>`${e.agentName??e.agentId} · ${e.active?`active`:`last seen ${Q(e.lastSeenAt)}`}`),activePresence:d.filter(e=>e.active).length,attempts:Math.max(u?.attempt??0,...S,C),failures:s.filter(e=>e.type.includes(`failed`)).length,completions:s.filter(e=>e.type.includes(`completed`)).length,lastFailure:u?.lastFailureKind??u?.error??w?.note,lastResult:u?.lastResult??T?.note,eventCount:s.length,lastActivity:s[0]}}function Q(e){if(!e)return`—`;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function pr(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 mr({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 hr({items:e}){let{t}=n();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 gr({board:e,task:t,events:r,presence:i,sessionId:a,sessionProvider:o,sessionModel:s}){let{t:c}=n(),l=fr(e,t,r,a,o,s,i),u=t.assignment,d=t.successCriteria?.length??0,f=t.successCriteria?.filter(e=>e.status===`passed`).length??0,p=[t.parentTaskId,...t.childTaskIds??[],t.chain?.previousTaskId,t.chain?.nextTaskId,t.mergedIntoTaskId,...t.mergedFromTaskIds??[]].filter(e=>!!e),m=dr(e,[...new Set(p)]);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)(re,{className:`size-4 text-primary`}),(0,K.jsx)(`span`,{className:`text-xs font-semibold`,children:c(`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:c(`activity:taskIntel.eventsCount`,{count:l.eventCount})}),(0,K.jsx)(M,{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:l.column}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[c(`activity:taskIntel.stagePrefix`),t.lifecycle?.currentStage??c(`activity:taskIntel.legacyStage`)]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[c(`activity:taskIntel.priorityPrefix`),t.priority]}),(0,K.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5`,children:[c(`activity:taskIntel.typePrefix`),t.type??c(`activity:taskIntel.inferredType`)]})]}),(0,K.jsxs)(`p`,{className:`mt-2 text-[11px] leading-4`,children:[(0,K.jsx)(`strong`,{children:c(`activity:taskIntel.whyHere`)}),` `,l.reason]}),l.blockers.length>0&&(0,K.jsx)(`p`,{className:`mt-1 text-[10px] text-warning`,children:c(`activity:taskIntel.unresolvedBlockers`,{count:l.blockers.length})})]}),(0,K.jsxs)(`div`,{className:`grid gap-2 xl:grid-cols-2`,children:[(0,K.jsxs)(mr,{icon:(0,K.jsx)(j,{className:`size-3`}),title:c(`activity:taskIntel.ownershipRuntime`),children:[(0,K.jsx)($,{label:c(`activity:taskIntel.owner`),value:l.owner}),(0,K.jsx)($,{label:c(`activity:taskIntel.assignee`),value:Z(t.assignee)??Z(t.assignedAgent)??`—`}),(0,K.jsx)($,{label:c(`activity:taskIntel.agentId`),value:Z(u?.agentId)??`—`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.agentNameRole`),value:[Z(u?.name),Z(u?.role)].filter(Boolean).join(` · `)||`—`}),(0,K.jsx)($,{label:c(`activity:taskIntel.runStatus`),value:Z(u?.status)??`unassigned`}),(0,K.jsx)($,{label:c(`activity:taskIntel.subagent`),value:Z(u?.subagentId)??`—`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.runTask`),value:Z(u?.runTaskId)??`—`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.sessionS`),value:l.sessions.join(`, `)||`Unknown`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.usersPresence`),value:l.presence.length?l.presence.join(`, `):`No task-scoped presence recorded`})]}),(0,K.jsxs)(mr,{icon:(0,K.jsx)(ae,{className:`size-3`}),title:c(`activity:taskIntel.modelRouteFallback`),children:[(0,K.jsx)($,{label:c(`activity:taskIntel.routingMode`),value:l.routingMode}),(0,K.jsx)($,{label:c(`activity:taskIntel.primary`),value:l.primaryModel,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.provider`),value:l.provider??`—`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.model`),value:l.model??`—`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.fallbackRoute`),value:l.fallbackRoute,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.skills`),value:u?.skills?.map(Z).filter(Boolean).join(`, `)||`Default`}),(0,K.jsx)($,{label:c(`activity:taskIntel.tools`),value:u?.tools?.map(Z).filter(Boolean).join(`, `)||`Default toolset`}),(0,K.jsx)($,{label:c(`activity:taskIntel.capabilities`),value:u?.allowedCapabilities?.map(Z).filter(Boolean).join(`, `)||`Safe defaults`,mono:!0})]}),(0,K.jsxs)(mr,{icon:(0,K.jsx)(D,{className:`size-3`}),title:c(`activity:taskIntel.executionPolicyOutcome`),children:[(0,K.jsx)($,{label:c(`activity:taskIntel.attempts`),value:`${l.attempts}${u?.maxAttempts?` / ${u.maxAttempts}`:``}`}),(0,K.jsx)($,{label:c(`activity:taskIntel.retryPolicy`),value:u?.retryPolicy??t.retryPolicy??`off`}),(0,K.jsx)($,{label:c(`activity:taskIntel.costCeiling`),value:(u?.costCeilingUsd??t.costCeilingUsd)==null?`Unbounded`:`$${(u?.costCeilingUsd??t.costCeilingUsd).toFixed(2)}`}),(0,K.jsx)($,{label:c(`activity:taskIntel.failuresDone`),value:`${l.failures} / ${l.completions}`}),(0,K.jsx)($,{label:c(`activity:taskIntel.checks`),value:`${f} / ${d} passed`}),(0,K.jsx)($,{label:c(`activity:taskIntel.lastFailure`),value:l.lastFailure??`—`}),(0,K.jsx)($,{label:c(`activity:taskIntel.result`),value:l.lastResult??`No result recorded`})]}),(0,K.jsxs)(mr,{icon:(0,K.jsx)(h,{className:`size-3`}),title:c(`activity:taskIntel.timingAuditCoverage`),children:[(0,K.jsx)($,{label:c(`activity:taskIntel.created`),value:Q(t.createdAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.updated`),value:Q(t.updatedAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.due`),value:Q(t.dueDate)}),(0,K.jsx)($,{label:c(`activity:taskIntel.dispatched`),value:Q(u?.dispatchedAt??u?.claimedAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.completed`),value:Q(u?.completedAt??t.completedAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.duration`),value:pr(u?.dispatchedAt??u?.claimedAt,u?.completedAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.heartbeat`),value:Q(u?.heartbeatAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.leaseExpires`),value:Q(u?.leaseExpiresAt)}),(0,K.jsx)($,{label:c(`activity:taskIntel.actors`),value:l.actors.join(`, `)||`Unknown`,mono:!0})]})]}),(0,K.jsxs)(mr,{icon:(0,K.jsx)(_,{className:`size-3`}),title:c(`activity:taskIntel.dependenciesChainProvenance`),children:[(0,K.jsx)($,{label:c(`activity:taskIntel.dependencies`),value:(0,K.jsx)(hr,{items:l.dependencies})}),(0,K.jsx)($,{label:c(`activity:taskIntel.otherRelations`),value:(0,K.jsx)(hr,{items:m})}),(0,K.jsx)($,{label:c(`activity:taskIntel.chain`),value:t.chain?`${t.chain.chainId} · position ${t.chain.order}`:`None`,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.originSystem`),value:t.origin?.system??`manual`}),(0,K.jsx)($,{label:c(`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:c(`activity:taskIntel.taskId`),value:t.id,mono:!0}),(0,K.jsx)($,{label:c(`activity:taskIntel.boardId`),value:e.id,mono:!0})]})]})]})}function _r({graph:e,expanded:t}){return(0,K.jsx)(`div`,{"data-contract-canvas":t?`expanded`:`embedded`,className:t?`h-full min-h-0 w-full bg-background`:`h-[32rem] min-h-[32rem] w-full bg-background`,children:(0,K.jsxs)(ie,{nodes:e.nodes,edges:e.edges,fitView:!0,fitViewOptions:{padding:t?.12:.2,maxZoom:t?1.15:.9},minZoom:.12,maxZoom:1.6,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,panOnDrag:!0,zoomOnScroll:t,proOptions:{hideAttribution:!0},children:[(0,K.jsx)(_e,{variant:le.Dots,gap:22,size:1.2,color:`hsl(var(--border))`}),(0,K.jsx)(ee,{showInteractive:!1,className:`!overflow-hidden !rounded-lg !border !border-border !bg-background !shadow-xl [&_button]:!border-border [&_button]:!bg-muted [&_button]:!fill-foreground`}),t&&(0,K.jsx)(ne,{pannable:!0,zoomable:!0,nodeColor:e=>String(e.data.color??`hsl(var(--muted-foreground))`),maskColor:`hsl(var(--background) / 0.72)`,className:`!border !border-border !bg-background`})]})})}function vr({board:e,task:n,sendKanban:r}){let[i,a]=(0,U.useState)(!1),o=(0,U.useMemo)(()=>en(e,n.id),[e,n.id]),s=(0,U.useMemo)(()=>$t(e,n.id),[e,n.id]),c=(0,U.useMemo)(()=>fn(e,n,o.evaluatedNodeIds),[e,n,o.evaluatedNodeIds]);if(!e.contractGraph)return(0,K.jsxs)(`section`,{className:`mt-4 rounded-md border border-dashed p-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,K.jsx)(C,{size:14}),` Contract graph not configured`]}),(0,K.jsx)(`p`,{className:`mt-1`,children:`Objectives, affected components, guardrails, risks, and verification evidence are not yet mapped for this board.`}),r&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(`kanban.contract.configure`,{boardId:e.id,enforcement:`advisory`}),className:`mt-2 rounded-md bg-primary/10 px-2.5 py-1.5 font-medium text-primary hover:bg-primary/20`,children:`Start contract map`})]});let l=o.allowed&&o.issues.length===0;return(0,K.jsxs)(`section`,{className:`mt-4 overflow-hidden rounded-md border bg-background`,children:[(0,K.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold`,children:[(0,K.jsx)(C,{size:14}),` Contract graph`,(0,K.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:e.contractGraph.enforcement})]}),(0,K.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2 text-[11px]`,children:[(0,K.jsx)(`span`,{className:s.ready?`text-primary`:`text-warning`,children:s.ready?`Start ready`:`${s.issues.length} setup gaps`}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1 ${l?`text-success`:`text-warning`}`,children:[l?(0,K.jsx)(u,{size:13}):(0,K.jsx)(m,{size:13}),l?`Closed`:`${o.issues.length} completion open`]}),c.nodes.length>1&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`inline-flex items-center gap-1.5 rounded-md border border-primary/25 bg-primary/10 px-2 py-1 font-semibold text-primary transition-colors hover:bg-primary/20`,"aria-label":`Expand Contract Map`,children:[(0,K.jsx)(t,{size:12}),` Expand`]})]})]}),c.nodes.length>1?(0,K.jsx)(_r,{graph:c,expanded:!1}):(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:`No contract nodes belong to this task.`}),o.issues.length>0&&(0,K.jsx)(`div`,{className:`space-y-1 border-t px-3 py-2`,children:o.issues.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-warning`,children:[(0,K.jsx)(D,{className:`mt-0.5 shrink-0`,size:12}),(0,K.jsx)(`span`,{children:e.message})]},`${e.code}:${e.nodeId??e.edgeId??t}`))}),s.issues.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1 border-t px-3 py-2`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Before implementation`}),s.issues.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-warning`,children:[(0,K.jsx)(m,{className:`mt-0.5 shrink-0`,size:12}),(0,K.jsx)(`span`,{children:e.message})]},`readiness:${e.code}:${e.nodeId??t}`))]}),(0,K.jsx)(je,{open:i,onOpenChange:a,children:(0,K.jsxs)(ke,{"aria-describedby":`contract-map-modal-description`,className:`flex h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-[calc(100vw-2rem)] flex-col gap-0 overflow-hidden border-border bg-background p-0 text-foreground sm:p-0`,children:[(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-border bg-background/90 px-5 py-4 pr-14 text-foreground`,children:[(0,K.jsxs)(Ae,{className:`flex items-center gap-2 text-base`,children:[(0,K.jsx)(C,{size:17,className:`text-primary`}),` Contract Map · `,n.title]}),(0,K.jsx)(H,{id:`contract-map-modal-description`,className:`mt-1 text-xs text-muted-foreground`,children:`Full dependency field · drag to pan, scroll or controls to zoom, Escape to close.`})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(_r,{graph:c,expanded:!0})})]})})]})}var yr={passed:{icon:u,labelKey:`activity:verifyReport.verdictPassed`,className:`text-success`},failed:{icon:xe,labelKey:`activity:verifyReport.verdictFailed`,className:`text-destructive`},needs_human:{icon:m,labelKey:`activity:verifyReport.verdictNeedsHuman`,className:`text-warning`},incomplete:{icon:y,labelKey:`activity:verifyReport.verdictIncomplete`,className:`text-muted-foreground`}},br={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 xr(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 Sr({verdict:e}){let{t}=n(),r=yr[e],i=r.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 ${r.className}`,children:[(0,K.jsx)(i,{size:13}),t(r.labelKey)]})}function Cr({title:e,icon:t,defaultOpen:n=!1,children:r}){let[i,a]=(0,U.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)(M,{size:13}):(0,K.jsx)(I,{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 wr({check:e}){let t=br[e.status],{t:r}=n(),[i,a]=(0,U.useState)(!1),o=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:r(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})]}),o&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(!i),className:`shrink-0 text-muted-foreground hover:text-foreground`,children:i?(0,K.jsx)(M,{size:13}):(0,K.jsx)(I,{size:13})})]}),i&&(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)(O,{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 Tr({fileScope:e}){let{t}=n();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 Er({subtasks:e}){let{t}=n();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 Dr({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)(v,{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 Or({report:e}){let{t}=n();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)(Sr,{verdict:e.verdict})]}),e.markdownSummary&&(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:xr(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)(Cr,{title:t(`activity:verifyReport.checkResults`),icon:F,defaultOpen:e.verdict!==`passed`,children:e.checks.map(e=>(0,K.jsx)(wr,{check:e},e.checkId))}),e.fileScope&&(0,K.jsx)(Cr,{title:t(`activity:verifyReport.fileScope`),icon:O,defaultOpen:!e.fileScope.scopeMatches,children:(0,K.jsx)(Tr,{fileScope:e.fileScope})}),e.subtasks&&(0,K.jsx)(Cr,{title:t(`activity:verifyReport.subTasks`),icon:F,children:(0,K.jsx)(Er,{subtasks:e.subtasks})}),e.attachments.length>0&&(0,K.jsx)(Cr,{title:`Attachments (${e.attachments.length})`,icon:v,children:(0,K.jsx)(Dr,{attachments:e.attachments})})]})}function kr({board:e,task:t,sendKanban:r}){let{t:i}=n(),a=e.id,o=Mt(t,De(e=>e.verificationActivity[`${a}:${t.id}`])),s;return s=o===`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)(he,{size:14,className:`animate-spin`}),i(`activity:taskVerify.verificationRunningChecksAreBeingExecuted`)]}):t.verificationReport?(0,K.jsxs)(`div`,{className:`mt-4`,children:[(0,K.jsx)(Or,{report:t.verificationReport}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(`kanban.task.verify`,{boardId:a,taskId:t.id}),className:`mt-1.5 rounded-md border px-2 py-1 text-[11px] text-muted-foreground hover:bg-muted`,children:i(`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)(E,{size:14}),(0,K.jsx)(`span`,{className:`font-medium`,children:i(`activity:taskVerify.unverified`)}),(0,K.jsx)(`span`,{children:i(`activity:taskVerify.noVerificationReportExistsForThis`)})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(`kanban.task.verify`,{boardId:a,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:i(`activity:taskVerify.runVerification`)})]}),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vr,{board:e,task:t,sendKanban:r}),s]})}function Ar({boards:e,board:r,task:i,runLink:a,onClose:o,onSelectTask:s,sendKanban:c,sendRaw:u,activityEvents:d,activityPresence:f,activityLoading:p,activityError:m,activitySessionId:h,refreshActivity:g}){let{t:_}=n(),[v,y]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[E,ee]=(0,U.useState)(``),[te,ne]=(0,U.useState)(``),[O,k]=(0,U.useState)(`session`),[re,ie]=(0,U.useState)(``),[ae,oe]=(0,U.useState)([]),[se,ce]=(0,U.useState)([]),[le,de]=(0,U.useState)([]),[fe,pe]=(0,U.useState)([]),[j,me]=(0,U.useState)(``),he=Me(!!i),N=ft(!!i),_e=q(N.sessionProvider),P=q(N.sessionModel),F=Fe(`kanban-task-inspector`,!!i),[I,ye]=(0,U.useState)(!1),[L,R]=(0,U.useState)(!1),[z,be]=(0,U.useState)(`definition`),[B,xe]=(0,U.useState)(``),[Se,Ce]=(0,U.useState)(``),[we,Te]=(0,U.useState)(``),[Ee,De]=(0,U.useState)(`pending`),[Oe,ke]=(0,U.useState)(``),[Ae,H]=(0,U.useState)(``),[je,Pe]=(0,U.useState)(``),[Ie,Le]=(0,U.useState)(`medium`),[Re,ze]=(0,U.useState)(`chore`),[Be,Ve]=(0,U.useState)(``),[He,Ue]=(0,U.useState)([]),[We,Ge]=(0,U.useState)([]),[Ke,qe]=(0,U.useState)(!1),[Je,Ye]=(0,U.useState)(``),[Xe,Ze]=(0,U.useState)(``),[Qe,$e]=(0,U.useState)(`off`),[et,tt]=(0,U.useState)(``),[nt,rt]=(0,U.useState)(``),[it,W]=(0,U.useState)(``),[at,ot]=(0,U.useState)(``),[st,ct]=(0,U.useState)(``),[lt,G]=(0,U.useState)(`observation`),[ut,dt]=(0,U.useState)(`unknown`),[mt,ht]=(0,U.useState)(``);(0,U.useEffect)(()=>{let t=q(i?.assignment?.provider),n=q(i?.assignment?.model);y(q(i?.assignment?.agentId)??q(i?.assignedAgent)??``),C(q(i?.assignment?.name)??``),T(q(i?.assignment?.role)??``),ee(t??``),ne(n??``),k(i?.assignment?.modelRouting??(t||n?`fixed`:`session`)),ie(q(i?.assignment?.fallbackProfile)??``),oe(i?.assignment?.fallbackModels??[]),ce(i?.assignment?.skills??[]),de(i?.assignment?.tools??[]),pe(i?.assignment?.allowedCapabilities??[]),me(e.find(e=>e.id!==r?.id)?.id??``),xe(i?.title??``),Ce(i?.description??``),Te(i?.dueDate??``),De(i?.status??`pending`),ke(``),H(``),Pe(``),Le(i?.priority??`medium`),ze(i?.type??`chore`),Ve(i?.labels?.join(`, `)??``),Ue(i?.dependsOn??[]),Ge(i?.chain&&r?r.tasks.filter(e=>e.chain?.chainId===i.chain?.chainId).sort((e,t)=>(e.chain?.order??0)-(t.chain?.order??0)).map(e=>e.id):i?[i.id]:[]),qe(!1),Ye(i?.estimatedHours?.toString()??``),Ze(i?.actualHours?.toString()??``),$e(i?.retryPolicy??i?.assignment?.retryPolicy??`off`),tt((i?.costCeilingUsd??i?.assignment?.costCeilingUsd)?.toString()??``),rt(i?.assignment?.maxAttempts?.toString()??``),W(``),ot(``),ct(``),G(`observation`),dt(`unknown`),ht(``)},[r?.id,i?.id]);let gt=e=>({boardId:r?.id,taskId:i?.id,...v.trim()?{agentId:v.trim()}:{},...S.trim()?{name:S.trim()}:{},...w.trim()?{role:w.trim()}:{},modelRouting:O,...O===`fixed`&&E.trim()?{provider:E.trim()}:{},...O===`fixed`&&te.trim()?{model:te.trim()}:{},...O===`fallback_profile`&&re.trim()?{fallbackProfile:re.trim()}:{},fallbackModels:ae,skills:se,tools:le,allowedCapabilities:fe,...nt?{maxAttempts:Number(nt)}:{},...et?{costCeilingUsd:Number(et)}:{},retryPolicy:Qe,activityNote:mt.trim()||`${_(`activity:kanban.activityNoteTemplate`,{action:_(e===`dispatch`?`activity:kanban.dispatched`:`activity:kanban.assigned`),target:S.trim()||v.trim()||w.trim()||_(`activity:kanban.configuredAgentRoute`)})}`}),_t=()=>{!r||!i||!B.trim()||(c(`kanban.task.update`,{boardId:r.id,taskId:i.id,title:B.trim(),description:Se,dueDate:we||null,...r.lifecycle?.mode===`managed`?{}:{status:Ee},priority:Ie,type:Re,labels:Be.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOn:He,...i.chain&&We.length<=1?{chain:null}:{},estimatedHours:Je?Number(Je):0,actualHours:Xe?Number(Xe):0,retryPolicy:Qe,costCeilingUsd:et?Number(et):null,activityNote:mt.trim()||`Task contract edited in WebUI.`}),We.length>1&&c(`kanban.task.chain`,{boardId:r.id,taskIds:We,enforceDependencies:Ke}),ht(``))},vt=[`backlog`,`todo`,`running`,`review`,`done`],yt=i?.lifecycle?.currentStage,bt=yt?vt.indexOf(yt):-1,xt=bt>=0&&bt<vt.length-1?vt[bt+1]:void 0,St=()=>{!r||!i||!xt||!Oe.trim()||c(`kanban.task.transition`,{boardId:r.id,taskId:i.id,to:xt,actor:v.trim()||S.trim()||i.assignee||i.assignedAgent||`webui-agent`,comment:Oe.trim(),...Ae.trim()?{action:Ae.trim()}:{},...je.trim()?{attachment:{url:je.trim(),type:`url`,title:`Evidence for ${i.title}`}}:{}})},Ct=()=>{!r||!i||!it.trim()||(c(`kanban.task.check.add`,{boardId:r.id,taskId:i.id,description:it.trim(),checkType:`manual`}),W(``))},wt=()=>{!r||!i||!at.trim()||(c(`kanban.task.activity.add`,{boardId:r.id,taskId:i.id,kind:lt,outcome:ut,summary:at.trim(),...st.trim()?{details:st.trim()}:{},actor:S.trim()||v.trim()||`webui-operator`}),ot(``),ct(``),window.setTimeout(g,150))},Et=()=>{!r||!i||(c(`kanban.task.assign`,gt(`assign`)),ht(``))},Dt=()=>{!r||!i||(c(`kanban.task.dispatch`,gt(`dispatch`)),ht(``))},Ot=()=>{!r||!i||!j||c(`kanban.task.copy`,{boardId:r.id,taskId:i.id,targetBoardId:j})},kt=()=>{!r||!i||!j||c(`kanban.task.transfer`,{boardId:r.id,taskId:i.id,targetBoardId:j})};if(!i)return null;let At=Fn(r,i),jt=d.filter(e=>e.taskId===i.id).length;return(0,K.jsxs)(`aside`,{"aria-label":_(`activity:kanban.taskInspector`),"data-expanded":L?`true`:`false`,className:V(`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`,L?`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:V(`flex h-12 items-center gap-2 border-b px-3`,L&&`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:_(`activity:kanban.task`)}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:i.id.slice(0,8)})]}),(0,K.jsx)(`button`,{type:`button`,title:_(L?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-label":_(L?`activity:kanban.collapseDetails`:`activity:kanban.expandDetails`),"aria-pressed":L,onClick:()=>R(e=>!e),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`,children:L?(0,K.jsx)(ge,{size:16}):(0,K.jsx)(t,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:_(`common:action.close`),onClick:()=>{R(!1),o()},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})})]}),(0,K.jsx)(Rn,{task:i,blockedBy:At,columnLabel:Lt(r,i.columnId),expanded:L,blockedLabel:_(`activity:kanbanInspector.waitingOn`),regionLabel:_(`activity:kanbanInspector.taskStatusSummary`)}),(0,K.jsx)(zn,{active:z,onSelect:be,badges:In(r,i,jt),labelFor:e=>_(e),expanded:L}),i?(0,K.jsx)(`div`,{ref:F,className:V(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,L&&`px-5 py-4 xl:px-7`),children:(0,K.jsxs)(Bn,{expanded:L,rail:z===`definition`?(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs xl:grid-cols-1`,children:[(0,K.jsx)(Rt,{label:_(`activity:kanban.source`),value:i.origin?.system??`manual`}),(0,K.jsx)(Rt,{label:_(`activity:kanban.taskId`),value:i.id.slice(0,8)}),(0,K.jsx)(Rt,{label:_(`activity:kanban.run`),value:i.assignment?.status??`unassigned`}),(0,K.jsx)(Rt,{label:_(`activity:kanban.column`),value:Lt(r,i.columnId)})]}):z===`execution`&&r?(0,K.jsx)(Kt,{board:r,task:i,events:d}):void 0,children:[z===`definition`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-background p-2.5`,children:[(0,K.jsx)(Tt,{title:_(`activity:kanban.taskBoundary`),value:i.boundary,inherited:r?.boundary,onSave:e=>{r&&c(`kanban.task.update`,{boardId:r.id,taskId:i.id,boundary:e,activityNote:`Task boundary edited in WebUI.`})}}),(0,K.jsx)(J,{label:_(`activity:kanban.title`),value:B,onChange:xe}),(0,K.jsxs)(`label`,{className:`block`,children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:_(`activity:kanbanInspector.descriptionWorkingContext`)}),(0,K.jsx)(`textarea`,{value:Se,onChange:e=>Ce(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:[r?.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:_(`activity:kanban.managedStage`)}),(0,K.jsx)(`div`,{className:`mt-1 text-xs font-semibold capitalize`,children:i.lifecycle?.currentStage??`Backlog`})]}):(0,K.jsx)(zt,{label:_(`activity:kanban.status`),value:Ee,options:[`pending`,`ready`,`in_progress`,`blocked`,`review`,`completed`,`failed`,`archived`],onChange:e=>De(e)}),(0,K.jsx)(zt,{label:_(`activity:kanban.priority`),value:Ie,options:[`critical`,`high`,`medium`,`low`],onChange:e=>Le(e)}),(0,K.jsx)(zt,{label:_(`activity:kanban.type`),value:Re,options:[`feature`,`bugfix`,`refactor`,`docs`,`test`,`chore`],onChange:e=>ze(e)}),(0,K.jsx)(J,{label:_(`activity:kanban.labelsCommaSeparated`),value:Be,onChange:Ve})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(J,{label:_(`activity:kanban.dueDatePlaceholder`),value:we,onChange:Te}),(0,K.jsx)(J,{label:_(`activity:kanban.estimatedHours`),value:Je,onChange:Ye}),(0,K.jsx)(J,{label:_(`activity:kanban.actualHours`),value:Xe,onChange:Ze})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:_(`activity:kanbanInspector.dependencies`)}),(0,K.jsx)(pt,{options:(r?.tasks??[]).filter(e=>e.id!==i.id).map(e=>({value:e.id,label:e.title,description:e.status})),selected:He,onChange:Ue,placeholder:_(`activity:kanban.selectBlockingTasks`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:_(`activity:kanbanInspector.taskChainSelectionOrder`)}),(0,K.jsx)(pt,{options:(r?.tasks??[]).map(e=>({value:e.id,label:e.title,description:e.status})),selected:We,onChange:e=>Ge(e.includes(i.id)?e:[i.id,...e]),placeholder:_(`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:Ke,onChange:e=>qe(e.target.checked)}),_(`activity:kanban.enforceChainOrder`)]})]}),(0,K.jsx)(J,{label:_(`activity:kanban.assignmentReason`),value:mt,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)(ve,{size:15}),` `,_(`activity:kanbanInspector.saveTaskContract`)]})]}),!L&&(0,K.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 text-xs`,children:[(0,K.jsx)(Rt,{label:_(`activity:kanban.source`),value:i.origin?.system??`manual`}),(0,K.jsx)(Rt,{label:_(`activity:kanban.taskId`),value:i.id.slice(0,8)}),(0,K.jsx)(Rt,{label:_(`activity:kanban.run`),value:i.assignment?.status??`unassigned`}),(0,K.jsx)(Rt,{label:_(`activity:kanban.column`),value:Lt(r,i.columnId)})]})]}),z===`execution`&&(0,K.jsxs)(K.Fragment,{children:[r?.lifecycle?.mode===`managed`&&xt&&(0,K.jsxs)(`section`,{"aria-label":_(`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:_(`activity:kanban.kanbanAgentTransition`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[yt,` → `,xt,`; no stages can be skipped.`]})]}),(0,K.jsx)(D,{size:16,className:`text-primary`})]}),(0,K.jsx)(J,{label:_(`activity:kanban.completedAction`),value:Ae,onChange:H}),(0,K.jsx)(J,{label:_(`activity:kanban.progressComment`),value:Oe,onChange:ke}),(0,K.jsx)(J,{label:_(`activity:kanban.evidenceUrl`),value:je,onChange:Pe}),(0,K.jsxs)(`button`,{type:`button`,disabled:!Oe.trim(),onClick:St,className:`inline-flex h-9 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,K.jsx)(l,{size:15}),` Advance to `,xt]})]}),r&&(0,K.jsx)(gr,{board:r,task:i,events:d,presence:f,sessionId:h,sessionProvider:_e,sessionModel:P}),r&&(0,K.jsx)(lr,{task:i,events:d,sessionId:h}),i.assignment&&(0,K.jsx)(jn,{assignment:i.assignment}),a&&i.origin?.taskId&&(0,K.jsx)(On,{runLink:a,runTaskId:i.origin.taskId,modelCandidates:he,sendRaw:u}),!a&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.jsx)(zt,{label:_(`activity:kanban.primaryModelSource`),value:O,options:[`session`,`fixed`,`fallback_profile`],onChange:e=>k(e)}),O===`session`&&(0,K.jsxs)(`div`,{className:`rounded-md border bg-info/5 px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Uses the live session model:`,` `,_e?`${_e}/`:``,P||`not available`,`.`]}),O===`fixed`&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:_(`activity:kanbanInspector.fixedProviderModel`)}),(0,K.jsx)(Ne,{value:te||void 0,provider:E||void 0,candidates:he,placeholder:_(`activity:kanban.selectProviderModel`),onPick:(e,t)=>{ne(e),ee(t)}})]}),O===`fallback_profile`&&(0,K.jsx)(zt,{label:_(`activity:kanban.fallbackProfile`),value:re,options:Object.keys(N.fallbackProfiles),placeholder:_(`activity:kanban.selectProfile`),onChange:ie}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-muted-foreground`,children:_(`activity:kanban.fallbackModels`)}),(0,K.jsx)(pt,{options:he.map(e=>({value:`${e.provider}/${e.model}`,label:e.label,description:e.description,tag:e.provider})),selected:ae,onChange:oe,placeholder:_(`activity:kanban.addFallbackModel`),emptyLabel:`No models — add a provider in Settings`})]}),(0,K.jsx)(zt,{label:_(`activity:kanban.role`),value:w,options:Vn,placeholder:_(`activity:kanban.selectRole`),onChange:T}),(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:_(`activity:kanbanInspector.forceLoadedIntoTheWorker`)})]}),(0,K.jsx)(pt,{options:N.skills.map(e=>({value:e.name,label:e.name,description:e.description,tag:e.source})),selected:se,onChange:ce,placeholder:_(`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:_(`activity:kanbanInspector.blankFullDefaultToolset`)})]}),(0,K.jsx)(pt,{options:N.tools.map(e=>({value:e.name,label:e.name,description:e.description})),selected:le,onChange:de,placeholder:_(`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:()=>ye(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:[_(`activity:kanbanInspector.advanced`),(0,K.jsx)(M,{size:13,className:V(`transition-transform`,I&&`rotate-180`)})]}),I&&(0,K.jsxs)(`div`,{className:`space-y-3 border-t p-2`,children:[(0,K.jsx)(J,{label:_(`activity:kanban.agentNameOptional`),value:S,onChange:C}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,K.jsx)(zt,{label:_(`activity:kanban.retryPolicy`),value:Qe,options:[`off`,`incremental`,`exponential`],onChange:e=>$e(e)}),(0,K.jsx)(J,{label:_(`activity:kanban.maxAttempts`),value:nt,onChange:rt}),(0,K.jsx)(J,{label:_(`activity:kanban.costCeilingUsd`),value:et,onChange:tt})]}),(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:_(`activity:kanbanInspector.blankSafeDefaults`)})]}),(0,K.jsx)(pt,{options:Hn,selected:fe,onChange:pe,placeholder:_(`activity:kanban.grantCapability`)})]})]})]})]}),(0,K.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:Et,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted`,children:[(0,K.jsx)(b,{size:15}),_(`activity:kanbanInspector.assign`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:Dt,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)(ue,{size:15}),_(`activity:kanbanInspector.dispatch`)]})]})]}),e.length>1&&!a?(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:_(`activity:kanban.targetBoard`)}),(0,K.jsx)(`select`,{value:j,onChange:e=>me(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!==r?.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:Ot,disabled:!j,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(x,{size:15}),_(`activity:kanbanInspector.copy`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:kt,disabled:!j,className:`inline-flex h-9 items-center justify-center gap-2 rounded-md border text-sm hover:bg-muted disabled:opacity-50`,children:[(0,K.jsx)(l,{size:15}),_(`activity:kanbanInspector.transfer`)]})]})]}):null]}),z===`evidence`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Nn,{board:r,task:i,newCheck:it,onNewCheckChange:W,onAddCheck:Ct,sendKanban:c}),r&&(0,K.jsx)(kr,{board:r,task:i,sendKanban:c})]}),z===`breakdown`&&r&&(0,K.jsx)(Sn,{board:r,task:i,sendKanban:c,onSelectTask:s}),z===`history`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(er,{task:i,events:d,sessionId:h,loading:p,error:m,onRefresh:g}),(0,K.jsx)(Mn,{activityKind:lt,activityOutcome:ut,note:at,details:st,onActivityKindChange:G,onActivityOutcomeChange:dt,onNoteChange:ot,onDetailsChange:ct,onRecordActivity:wt})]})]})}):null]})}var jr={unverified:{labelKey:`activity:kanbanTree.verifyUnverified`,className:`bg-muted text-muted-foreground`,icon:E},running:{labelKey:`activity:kanbanTree.verifyVerifying`,className:`bg-info/10 text-info`,icon:he},passed:{labelKey:`activity:kanbanTree.verifyVerified`,className:`bg-success/10 text-success`,icon:D},failed:{labelKey:`activity:kanbanTree.verifyFailed`,className:`bg-destructive/10 text-destructive`,icon:d},needs_human:{labelKey:`activity:kanbanTree.verifyNeedsReview`,className:`bg-warning/10 text-warning`,icon:m},incomplete:{labelKey:`activity:kanbanTree.verifyIncomplete`,className:`bg-warning/10 text-warning`,icon:m}};function Mr({task:e}){return e.status===`completed`?(0,K.jsx)(P,{size:13,className:`text-success`}):e.status===`failed`?(0,K.jsx)(A,{size:13,className:`text-destructive`}):e.status===`in_progress`?(0,K.jsx)(he,{size:13,className:`animate-spin text-info`}):(0,K.jsx)(N,{size:13,className:`text-muted-foreground`})}function Nr({board:e,selectedTaskId:t,onSelectTask:r}){let{t:i}=n(),a=De(e=>e.verificationActivity),o=(0,U.useMemo)(()=>It(Ft(e)),[e.id,e.revision]);return o.length?(0,K.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:o.map(({task:n,depth:o,children:s})=>{let c=Mt(n,a[`${e.id}:${n.id}`]),l=jr[c],u=l.icon,d=n.atomicityAssessment?.verdict;return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(n.id),style:{paddingLeft:`${o*22+8}px`},className:V(`flex w-full items-center gap-2 rounded-md border py-1.5 pr-2 text-left text-xs transition-colors`,t===n.id?`border-primary bg-primary/5`:`border-transparent hover:border-primary/40 hover:bg-muted/40`),children:[s.length>0?(0,K.jsx)(I,{size:12,className:`shrink-0 text-muted-foreground`}):(0,K.jsx)(`span`,{className:`w-3 shrink-0`}),(0,K.jsx)(Mr,{task:n}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:n.title}),n.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:V(`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}),n.decomposition?.status===`proposed`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-warning/10 px-1 py-0.5 text-[10px] text-warning`,children:i(`activity:kanbanTree.proposalPending`)}),(0,K.jsxs)(`span`,{className:V(`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}),i(l.labelKey)]})]})},n.id)})})}):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:i(`activity:kanbanTree.noTasksOnThisBoardYet`)})}function Pr({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:V(`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 Fr({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:V(`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 Ir({board:e,onSelectTask:t}){let{t:r}=n(),i=(0,U.useMemo)(()=>Pt(e),[e.id,e.revision]),a=i.gradedTasks?i.passed/i.gradedTasks*100:0;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)(Re,{pct:a}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold`,children:r(`activity:kanban.definitionOfDone`)}),(0,K.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[i.passed,` of `,i.gradedTasks,` graded tasks verified passed ·`,` `,i.totalTasks,` tasks total`]})]})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[(0,K.jsx)(Pr,{label:`verified`,value:i.passed,tone:`success`}),(0,K.jsx)(Pr,{label:`failed`,value:i.failed,tone:`destructive`}),(0,K.jsx)(Pr,{label:r(`activity:verifyReport.verdictNeedsHuman`),value:i.needsHuman,tone:`warning`}),(0,K.jsx)(Pr,{label:`incomplete`,value:i.incomplete,tone:`warning`}),(0,K.jsx)(Pr,{label:`unverified`,value:i.unverified,tone:`muted`})]}),(0,K.jsx)(Fr,{title:r(`activity:kanban.failingChecks`),icon:d,tone:`text-destructive`,onSelectTask:t,rows:i.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)(Fr,{title:r(`activity:kanban.evidenceMissing`),icon:m,tone:`text-warning`,onSelectTask:t,rows:i.missingEvidence.map(({task:e,check:t})=>({id:`${e.id}:${t.checkId}`,taskId:e.id,primary:e.title,secondary:t.description}))}),(0,K.jsx)(Fr,{title:r(`activity:kanban.needsDecomposition`),icon:k,tone:`text-warning`,onSelectTask:t,rows:i.needsDecomposition.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`atomicity score ${e.atomicityAssessment?.score??`?`} — split before dispatch`}))}),(0,K.jsx)(Fr,{title:r(`activity:kanban.decompositionPending`),icon:E,tone:`text-info`,onSelectTask:t,rows:i.pendingProposals.map(e=>({id:e.id,taskId:e.id,primary:e.title,secondary:`${e.decomposition?.proposedSubtasks.length??0} proposed subtasks`}))}),i.failingChecks.length===0&&i.missingEvidence.length===0&&i.needsDecomposition.length===0&&i.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)(D,{size:14}),r(`activity:kanban.noOutstanding`)]})]})}var Lr=[[`focus`,`Focus`],[`board`,`Board`],[`tree`,`Tree`],[`contracts`,`Contract Map`],[`dashboard`,`Verification`]];function Rr({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:Lr.map(([n,r])=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:V(`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))})}var zr={now:{title:`NOW`,subtitle:`Actively executing`,icon:g,tone:`border-amber-500/30 bg-amber-500/5`},next:{title:`NEXT`,subtitle:`Ready or queued`,icon:N,tone:`border-blue-500/30 bg-blue-500/5`},blocked:{title:`BLOCKED`,subtitle:`Needs intervention`,icon:y,tone:`border-red-500/30 bg-red-500/5`},review:{title:`REVIEW`,subtitle:`Needs proof or acceptance`,icon:u,tone:`border-violet-500/30 bg-violet-500/5`}};function Br({snapshot:e,loading:t,error:n,onRetry:r,onSelectTask:i}){return e?(0,K.jsxs)(`div`,{className:`h-full min-w-[760px] overflow-auto p-4`,children:[(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-xl border bg-gradient-to-br from-primary/10 via-background to-background`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4 border-b p-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-primary`,children:[(0,K.jsx)(ye,{size:15}),` Project workbench`]}),(0,K.jsx)(`h2`,{className:`mt-1 text-xl font-semibold`,children:`One truthful view of every active board`}),(0,K.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs text-muted-foreground`,children:`Session mirrors remain tactical; managed cards remain durable. This view only projects their shared execution state and never creates a second source of truth.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center text-xs`,children:[(0,K.jsx)(Hr,{label:`BOARDS`,value:e.boardCount}),(0,K.jsx)(Hr,{label:`ACTIVE`,value:e.totals.active}),(0,K.jsx)(Hr,{label:`ALERTS`,value:e.alertTotal,warning:e.alertTotal>0})]})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-5 gap-0 overflow-x-auto p-4`,children:e.flow.map((t,n)=>(0,K.jsxs)(`div`,{className:`relative min-w-32 px-2 text-center`,children:[(0,K.jsx)(`div`,{className:`mx-auto flex h-9 w-9 items-center justify-center rounded-full border bg-background text-sm font-bold`,children:t.count}),(0,K.jsx)(`div`,{className:`mt-2 text-xs font-semibold`,children:t.label}),(0,K.jsx)(`div`,{className:`mt-1 text-[10px] leading-4 text-muted-foreground`,children:t.explanation}),n<e.flow.length-1?(0,K.jsx)(L,{className:`absolute -right-2 top-2.5 text-muted-foreground/50`,size:14}):null]},t.id))})]}),e.alertTotal>0?(0,K.jsxs)(`section`,{className:`mt-3 rounded-xl border border-amber-500/30 bg-amber-500/5 p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-amber-600 dark:text-amber-400`,children:[(0,K.jsx)(m,{size:14}),` Attention required · `,e.alertTotal]}),(0,K.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:e.alerts.map(e=>(0,K.jsxs)(`button`,{type:`button`,disabled:!e.boardId||!e.taskId,onClick:()=>{e.boardId&&e.taskId&&i(e.boardId,e.taskId)},className:`rounded-lg border bg-background/70 p-2 text-left disabled:cursor-default`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium`,children:e.title}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[10px] leading-4 text-muted-foreground`,children:e.detail})]},e.id))}),e.alertsOmitted>0?(0,K.jsxs)(`div`,{className:`mt-2 text-[10px] text-muted-foreground`,children:[`+`,e.alertsOmitted,` more alerts hidden by the bounded view`]}):null]}):null,(0,K.jsx)(`section`,{className:`mt-3 grid gap-3 xl:grid-cols-4`,children:Object.keys(zr).map(t=>{let n=zr[t],r=e.lanes[t],a=n.icon;return(0,K.jsxs)(`div`,{className:`min-w-0 rounded-xl border p-3 ${n.tone}`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-bold tracking-wider`,children:[(0,K.jsx)(a,{size:13}),` `,n.title]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:n.subtitle})]}),(0,K.jsx)(`span`,{className:`rounded-full border bg-background px-2 py-0.5 text-xs font-semibold`,children:r.total})]}),(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:r.items.length>0?r.items.map(e=>(0,K.jsx)(Vr,{item:e,onSelect:i},`${e.boardId}:${e.taskId}`)):(0,K.jsx)(`div`,{className:`rounded-lg border border-dashed p-3 text-center text-[11px] text-muted-foreground`,children:`No work in this lane`})}),r.omitted>0?(0,K.jsxs)(`div`,{className:`mt-2 text-[10px] text-muted-foreground`,children:[`+`,r.omitted,` more cards hidden to keep focus`]}):null]},t)})})]}):(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 px-6 text-center text-sm text-muted-foreground`,children:[(0,K.jsx)(ye,{size:28,strokeWidth:1.5,"aria-hidden":`true`}),(0,K.jsx)(`div`,{children:t?`Loading project workbench…`:n?`Project workbench could not be loaded: ${n}`:`Project workbench has not been loaded yet.`}),t?null:(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted`,children:`Retry workbench`})]})}function Vr({item:e,onSelect:t}){return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(e.boardId,e.taskId),className:`w-full rounded-lg border bg-background p-2.5 text-left shadow-sm transition hover:border-primary/40 hover:shadow`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`strong`,{className:`line-clamp-2 text-xs leading-4`,children:e.title}),(0,K.jsx)(`span`,{className:`shrink-0 rounded bg-muted px-1.5 py-0.5 text-[9px] uppercase text-muted-foreground`,children:e.source})]}),(0,K.jsx)(`div`,{className:`mt-1 truncate text-[10px] text-muted-foreground`,children:e.boardTitle}),(0,K.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-[10px] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`rounded border px-1 py-0.5`,children:e.priority}),e.childProgress?(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(_,{size:10}),` `,e.childProgress.completed,`/`,e.childProgress.total,` `,`children`]}):null]}),(0,K.jsx)(`div`,{className:`mt-2 text-[10px] leading-4 text-foreground/80`,children:e.reason}),e.contractStatus?(0,K.jsxs)(`div`,{className:`mt-2 rounded border px-1.5 py-1 text-[9px] font-semibold uppercase ${e.contractStatus.startReady?`border-blue-500/30 bg-blue-500/5 text-blue-600 dark:text-blue-400`:`border-amber-500/30 bg-amber-500/5 text-amber-600 dark:text-amber-400`}`,children:[e.contractStatus.startReady?`Contract · start ready`:`Contract · ${e.contractStatus.setupGaps} setup gaps`,` `,`·`,` `,e.contractStatus.closed?`closed`:`${e.contractStatus.completionOpen} completion open`]}):null]})}function Hr({label:e,value:t,warning:n=!1}){return(0,K.jsxs)(`div`,{className:`min-w-16 rounded-lg border bg-background/70 px-2 py-1.5`,children:[(0,K.jsx)(`div`,{className:n?`font-bold text-amber-500`:`font-bold`,children:t}),(0,K.jsx)(`div`,{className:`text-[9px] text-muted-foreground`,children:e})]})}function Ur(){let[e,t]=(0,U.useState)([]);return(0,U.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 Wr=5e3,Gr=12;function Kr({onClose:e}){let{t}=n(),r=Te(e=>e.wsUrl),i=Ce(e=>e.session?.id??null),a=we(e=>e.agents),{boards:o,boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoard:d,loading:f,error:p,queueHealth:m,supervisorSnapshot:h,workbench:g,boardHistory:_,setActiveBoardId:v,setError:y,fetchBoardHistory:b}=De(),[C,w]=(0,U.useState)(``),[T,E]=(0,U.useState)(1),D=Ur(),[ee,te]=(0,U.useState)(``),ne=(0,U.useRef)(null);ze(ne);let[O,k]=(0,U.useState)(null),[re,ie]=(0,U.useState)(!1),[ae,oe]=(0,U.useState)([]),[se,le]=(0,U.useState)(),[ue,de]=(0,U.useState)(!1),[pe,j]=(0,U.useState)(null),[me,M]=(0,U.useState)(0),[he,N]=(0,U.useState)(null),[ge,_e]=(0,U.useState)(`board`),P=(0,U.useRef)(null),[F,I]=(0,U.useState)(!1),ve=(0,U.useRef)(null),ye=(0,U.useRef)(null),L=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(!F)return;let e=window.setTimeout(()=>{I(!1),ve.current=null},4e3);return()=>window.clearTimeout(e)},[F]),(0,U.useEffect)(()=>{I(!1),ve.current=null},[u]);let R=(0,U.useMemo)(()=>Se(r),[r]),z=d?.tasks.find(e=>e.id===O)??null,be=(0,U.useRef)([]),B=(0,U.useMemo)(()=>{let e=xt({sessionId:i,registrySessionIds:D,agents:a.values()}),t=be.current;return t.length===e.length&&t.every((t,n)=>t===e[n])?t:(be.current=e,e)},[a,D,i]),xe=o.filter(e=>Ee(e,B)),Oe=o.filter(e=>!Ee(e,B)),ke=(0,U.useMemo)(()=>d?Ue(d,{now:Date.now(),requireDueDate:d.lifecycle?.mode===`managed`}):null,[d]),Ae=(0,U.useMemo)(()=>St(d),[d]),H=(e,t={})=>{De.getState().sendKanban(e,t),R.send({type:e,payload:t})},je=(e,t={})=>{R.send({type:e,payload:t})},Me=(0,U.useMemo)(()=>Ct(d),[d]),Ne=(e=T)=>H(`kanban.list`,{page:e,pageSize:Gr,activeSessionIds:B});(0,U.useEffect)(()=>{Ne(),H(`kanban.workbench`,{limitPerLane:8,alertLimit:8})},[]),(0,U.useEffect)(()=>{if(L.current)return;let e=i?o.find(e=>e.tags?.includes(`session:${i}`)):void 0,t=!!(i&&e)&&ye.current!==i,n=t?e:u?void 0:o[0];n?.id&&(t&&(ye.current=i),v(n.id),H(`kanban.get`,{boardId:n.id}))},[o,u,i,v]),(0,U.useEffect)(()=>{d&&O&&!d.tasks.some(e=>e.id===O)&&k(null)},[d,O]),(0,U.useEffect)(()=>{let e=P.current;!e||d?.id!==e.boardId||(d.tasks.some(t=>t.id===e.taskId)&&(k(e.taskId),_e(`board`)),P.current=null)},[d]),(0,U.useEffect)(()=>{u&&(H(`kanban.health`,{boardId:u}),H(`kanban.supervisor.status`,{boardId:u}),b(u))},[u,b]),(0,U.useEffect)(()=>{if(!u)return;let e=setInterval(()=>{R.send({type:`kanban.get`,payload:{boardId:u}}),R.send({type:`kanban.health`,payload:{boardId:u}})},5e3);return()=>clearInterval(e)},[u,R]),(0,U.useEffect)(()=>{let e=setInterval(()=>{R.send({type:`kanban.list`,payload:{page:T,pageSize:Gr,activeSessionIds:B}})},8e3);return()=>clearInterval(e)},[B,T,R]),(0,U.useEffect)(()=>{let e=setInterval(()=>{R.send({type:`kanban.workbench`,payload:{limitPerLane:8,alertLimit:8}})},15e3);return()=>clearInterval(e)},[R]);let Pe=e=>{E(e),v(null),L.current=!0,Ne(e)};(0,U.useEffect)(()=>{le(void 0)},[u,O]),(0,U.useEffect)(()=>{if(!u||!O)return;let e=u,t=O;de(!0),j(null);let n=R.on(`kanban.task.activity`,n=>{let r=n.payload;if(r.success===!1){j(r.error??`Task activity could not be loaded.`),de(!1);return}r.data?.boardId===e&&r.data.taskId===t&&(oe(r.data.events??[]),le(r.data.presence??[]),de(!1))});return R.send({type:`kanban.task.activity`,payload:{boardId:e,taskId:t,limit:Wr}}),n},[u,O,z?.updatedAt,me,R]),(0,U.useEffect)(()=>{if(!(!u||!O))return R.on.bind(R)(`kanban.task.activity.changed`,e=>{let t=e.payload;t.boardId===u&&t.taskId===O&&M(e=>e+1)})},[u,O,R]);let Fe=()=>{let e=C.trim();e&&(w(``),H(`kanban.create`,{title:e,lifecycle:{mode:`managed`,columns:{backlog:`backlog`,todo:`todo`,running:`in-progress`,review:`review`,done:`done`}}}))},Ie=()=>{if(!d)return;let e=ee.trim();e&&(te(``),H(`kanban.task.add`,{boardId:d.id,title:e,columnId:d.columns[0]?.id??`backlog`,activityNote:`Task created manually in WebUI.`}))},Le=()=>{d&&H(`kanban.delete`,{boardId:d.id})},Re=()=>{d&&H(`kanban.duplicate`,{boardId:d.id,title:`${d.title} Copy`})},Be=e=>{d&&H(`kanban.task.remove`,{boardId:d.id,taskId:e.id})},Ve=(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;H(`kanban.task.move`,{boardId:d.id,taskId:e,columnId:t,activityNote:`Moved in WebUI${r?` from ${r}`:``} to ${i}.`})};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground md:flex-row`,children:[(0,K.jsx)(yt,{boardTotal:s,activeBoardTotal:c,orphanedBoardTotal:l,activeBoardId:u,activeBoards:xe,orphanedBoards:Oe,boardPage:T,boardPageSize:Gr,loading:f,newBoardTitle:C,onClose:e,onRefresh:()=>Ne(),onNewBoardTitleChange:w,onCreateBoard:Fe,onBoardSelect:e=>{L.current=!1,v(e),H(`kanban.get`,{boardId:e})},onBoardPageChange:Pe}),(0,K.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,K.jsxs)(`header`,{className:`flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 sm:px-4`,children:[(0,K.jsxs)(`div`,{className:`w-full min-w-0 sm:w-auto sm:flex-1`,children:[(0,K.jsx)(`h1`,{className:`truncate text-sm font-semibold`,children:d?.title??`No board selected`}),(0,K.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:d?`${d.columns.length} columns / ${d.tasks.length} tasks`:`Create or select a board`})]}),d&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`input`,{value:ee,onChange:e=>te(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Ie()},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:Ie,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)(S,{size:16})}),(0,K.jsx)(`button`,{type:`button`,title:t(`activity:kanban.duplicateBoard`),onClick:Re,className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,K.jsx)(x,{size:16})}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":re,title:t(`activity:kanban.boardHistory`),onClick:()=>{!re&&u&&b(u),ie(!re)},className:`flex h-8 w-8 items-center justify-center rounded-md border text-muted-foreground hover:bg-muted hover:text-foreground aria-pressed:bg-primary aria-pressed:text-primary-foreground`,children:(0,K.jsx)(ce,{size:16})}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":F,title:t(F?`activity:kanban.confirmDeleteBoard`:`activity:kanban.deleteBoard`),onClick:()=>{F&&ve.current===d?.id?(I(!1),ve.current=null,Le()):(ve.current=d?.id??null,I(!0))},className:V(`hidden h-8 items-center justify-center rounded-md border transition-colors sm:flex`,F?`w-16 gap-1 border-destructive/40 bg-destructive/15 text-[11px] font-semibold text-destructive`:`w-16 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`),children:F?t(`activity:kanban.confirmDelete`):(0,K.jsx)(fe,{size:16})})]})]}),d&&(0,K.jsx)(gt,{presence:d.presence}),d&&(0,K.jsx)(`div`,{className:`shrink-0 border-b px-3 py-2 sm:px-4`,children:(0,K.jsx)(Tt,{title:t(`activity:kanban.boardBoundary`),value:d.boundary,onSave:e=>{H(`kanban.update`,{boardId:d.id,boundary:e})}})}),d&&Me&&(0,K.jsx)(En,{runLink:Me,sendRaw:je}),d&&!Me&&d.tasks.length>0&&(0,K.jsx)(Dn,{boardId:d.id,sendKanban:H}),d&&(0,K.jsx)(_t,{board:d,snapshot:h,sendKanban:H}),ke&&(0,K.jsx)(kt,{audit:ke,onSelectTask:k}),d&&(0,K.jsx)(yn,{board:d,sendKanban:H,onSelectTask:k}),(0,K.jsx)(Rr,{viewMode:ge,onViewModeChange:e=>{_e(e),e===`focus`&&H(`kanban.workbench`,{limitPerLane:8,alertLimit:8})}}),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:`min-w-0 flex-1 truncate`,children:p}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`common:action.close`),onClick:()=>y(null),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded hover:bg-destructive/20`,children:(0,K.jsx)(A,{size:15})})]}),(0,K.jsx)(`div`,{ref:ne,className:`kanban-scroll-area min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-contain`,children:re?(0,K.jsx)(`div`,{className:`h-full overflow-y-auto p-4`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-muted-foreground`,children:t(`activity:kanban.boardHistory`)}),_.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`activity:kanban.noHistory`)}):(0,K.jsx)(`ol`,{className:`space-y-2`,children:[..._].reverse().map(e=>(0,K.jsxs)(`li`,{className:`rounded-md border bg-card p-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`span`,{className:`font-medium`,children:[e.type===`board.created`&&`🎉 `,e.type===`board.updated`&&`✏️ `,e.type===`board.deleted`&&`🗑️ `,e.type===`board.duplicated`&&`📋 `,e.type===`board.lifecycle.adopted`&&`🔄 `,e.type.replace(/^board\./,``)]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,children:new Date(e.ts).toLocaleString()})]}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.boardTitle,e.actor?` · ${e.actor}`:``]}),e.note?(0,K.jsx)(`div`,{className:`mt-1 text-xs italic text-muted-foreground`,children:e.note}):null]},e.id))})]})}):ge===`focus`?(0,K.jsx)(Br,{snapshot:g,loading:f,error:p,onRetry:()=>H(`kanban.workbench`,{limitPerLane:8,alertLimit:8}),onSelectTask:(e,t)=>{P.current={boardId:e,taskId:t},v(e),H(`kanban.get`,{boardId:e})}}):d?(0,K.jsxs)(K.Fragment,{children:[m&&(0,K.jsx)(Tn,{queueHealth:m,runningCostTotal:Ae}),ge===`tree`?(0,K.jsx)(Nr,{board:d,selectedTaskId:O,onSelectTask:k}):ge===`contracts`?(0,K.jsx)(vn,{board:d,onSelectTask:k}):ge===`dashboard`?(0,K.jsx)(Ir,{board:d,onSelectTask:k}):(0,K.jsx)(`div`,{className:`flex h-full min-w-max gap-3 p-4`,children:[...d.columns].sort((e,t)=>e.order-t.order).map(e=>(0,K.jsx)(Xt,{board:d,column:e,selectedTaskId:O,dragTaskId:he,setDragTaskId:N,onSelectTask:k,onDeleteTask:Be,onMoveTask:Ve},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)(Ar,{boards:o,board:d,task:z,runLink:Me,onClose:()=>k(null),onSelectTask:k,sendKanban:H,sendRaw:je,activityEvents:ae,activityPresence:se,activityLoading:ue,activityError:pe,activitySessionId:d?.tags?.find(e=>e.startsWith(`session:`))?.slice(8),refreshActivity:()=>M(e=>e+1)},z?.id??`none`)]})}export{Kr as KanbanView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Ea as n,Ft as r,Ga as i,Ji as a,Ni as o,Qr as s,Ri as c,Ua as l,Ui as u,Yn as d,an as f,dt as p,er as m,in as h,ir as g,jr as _,lt as v,pn as y,va as b,vn as x,xt as S}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as C}from"./utils-BecmXwgG.js";import{t as w}from"./mailbox-store-DhAVkVJQ.js";import{n as T}from"./ui-store-3HoYrTu5.js";import{o as E}from"./view-navigation-C1UDTk5R.js";import{f as D,g as O}from"./index-BLI23QVE.js";import{t as k}from"./empty-state-IT10GzRA.js";var A=e(i(),1),j=v(),M={note:s,ask:u,assign:h,steer:y,btw:b,broadcast:h,status:c,result:a,review:f},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?l.t(`common:time.justNow`):n<36e5?l.t(`common:time.minutesAgo`,{count:Math.round(n/6e4)}):n<864e5?l.t(`common:time.hoursAgo`,{count:Math.round(n/36e5)}):n<6048e5?l.t(`common:time.daysAgo`,{count:Math.round(n/864e5)}):t.toLocaleDateString()}function I({readBy:e}){let{t:n}=t(),r=Object.entries(e);return r.length===0?null:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsx)(`div`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wide`,children:n(`activity:mailbox.readBy`)}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(([e,t])=>(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-success/10 text-success`,title:P(t),children:[(0,j.jsx)(a,{className:`h-2.5 w-2.5`}),e]},e))})]})}function L({className:e}){let{t:i}=t(),s=T(e=>e.selectedMailMessage),c=T(e=>e.setSelectedMailMessage);(0,A.useEffect)(()=>()=>{c(null)},[c]);function l(){c(null),E(`chat`)}if(!s)return(0,j.jsx)(k,{icon:(0,j.jsx)(m,{className:`h-6 w-6`}),title:i(`activity:mailbox.emptyDetail`),description:i(`activity:mailbox.emptyDetailHint`)});let u=M[s.type]??d,f=i(`activity:mailbox.type.${s.type}`,{defaultValue:s.type}),h=N[s.priority]??N.normal,v=s.scope?{scope:s.scope,recipientSessionId:s.recipientSessionId}:w(s.to),y=s.to===`*`||s.to===`all`?i(`activity:mailbox.everyone`):s.to,b=v.scope===`session`?i(`activity:mailbox.sessionScope`,{sid:v.recipientSessionId??``}):v.scope===`project`?i(`activity:mailbox.projectScope`):i(`activity:mailbox.directScope`);return(0,j.jsx)(`div`,{className: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:l,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:i(`activity:mailbox.backToChat`),children:(0,j.jsx)(n,{className:`h-4 w-4`})}),(0,j.jsx)(`div`,{className:C(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,s.completed?`bg-success/10`:`bg-primary/10`),children:(0,j.jsx)(u,{className:C(`h-4 w-4`,s.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:s.subject}),s.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)(a,{className:`h-3 w-3`}),i(`activity:mailbox.completed`)]}),(0,j.jsx)(`span`,{className:C(`rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,h),children:s.priority||`normal`}),s.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)(g,{className:`h-2.5 w-2.5`}),` `,i(`activity:mailbox.audienceLeaders`)]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground/80`,children:s.from}),(0,j.jsx)(`span`,{children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate`,children:y}),v.scope===`session`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-warning/12 text-warning`,title:i(`activity:mailbox.sessionScopeTitle`,{sid:v.recipientSessionId??``}),children:[(0,j.jsx)(g,{className:`h-2.5 w-2.5`}),i(`activity:mailbox.sessionLabel`)]}),v.scope===`project`&&(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-semibold bg-primary/12 text-primary`,children:[(0,j.jsx)(_,{className:`h-2.5 w-2.5`}),i(`activity:mailbox.projectLabel`)]}),(0,j.jsx)(`span`,{className:`opacity-40`,children:`•`}),(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,j.jsx)(o,{className:`h-3 w-3`}),F(s.timestamp)]})]})]}),(0,j.jsx)(`button`,{type:`button`,onClick:l,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:i(`activity:mailbox.closeTitle`),children:(0,j.jsx)(p,{className:`h-4 w-4`})})]}),(0,j.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,j.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-5`,children:(0,j.jsx)(`div`,{className:`markdown-content prose prose-sm dark:prose-invert max-w-none text-sm leading-relaxed`,children:(0,j.jsx)(D,{components:O,children:s.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)(r,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:f})]}),(0,j.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,j.jsx)(`span`,{className:C(`rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase`,h),children:s.priority||`normal`})}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(S,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,title:s.from,children:s.from})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[v.scope===`session`?(0,j.jsx)(g,{className:`h-3 w-3 shrink-0 text-warning`}):(0,j.jsx)(_,{className:`h-3 w-3 shrink-0 text-primary`}),(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0`,children:i(`activity:mailbox.scopeLabel`)}),(0,j.jsx)(`span`,{className:`truncate`,children:b})]}),(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,j.jsx)(o,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{children:P(s.timestamp)})]}),s.replyTo&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(x,{className:`h-3 w-3 shrink-0`}),(0,j.jsx)(`span`,{className:`truncate`,children:i(`activity:mailbox.replyTo`,{id:s.replyTo})})]}),s.completed&&s.completedBy&&(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground col-span-2`,children:[(0,j.jsx)(a,{className:`h-3 w-3 shrink-0 text-success`}),(0,j.jsx)(`span`,{children:s.completedAt?i(`activity:mailbox.completedByAt`,{name:s.completedBy,time:P(s.completedAt)}):i(`activity:mailbox.completedBy`,{name:s.completedBy})})]}),s.outcome&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:i(`activity:mailbox.outcome`)}),(0,j.jsx)(`span`,{children:s.outcome})]}),s.taskContext&&(0,j.jsxs)(`div`,{className:`flex items-start gap-1.5 text-muted-foreground col-span-2 sm:col-span-4`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide shrink-0 mt-0.5`,children:i(`activity:mailbox.task`)}),(0,j.jsx)(`span`,{children:s.taskContext})]})]}),Object.keys(s.readBy??{}).length>0&&(0,j.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border/50`,children:(0,j.jsx)(I,{readBy:s.readBy})})]})]})})}export{L as MailboxDetailView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ba as t,Dn as n,Ga as r,Mr as i,Ot as a,Qr as o,Wt as s,dt as c,fi as l,lt as u,or as d,pi as f,ra as p,yn as m,zi as h}from"./vendor-DZ9_OO6N.js";import"./i18n-BeHaHx3x.js";import{t as g}from"./ws-client-C6jAU4nL.js";import{t as _}from"./utils-BecmXwgG.js";import{t as v}from"./button-Dhmop_yM.js";import{b as y,x as b}from"./index-BLI23QVE.js";import{g as x,h as S,l as C,r as w,v as T}from"./shared-BUXBOqyO.js";var E=e(r(),1);function D(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}var O={filePath:``,primaryMatches:[],symbolMatches:[],relatedMatches:[],totalCount:0,activeCount:0,supersededCount:0,reviewPendingCount:0};function k(e){let{filePath:t,lineStart:n,lineEnd:r,limit:i=50,showSuperseded:a=!0,showDeleted:o=!1,autoFetch:s=!0,sendOptions:c}=e,l=c?JSON.stringify(c):``,[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(!1),[m,h]=(0,E.useState)(null),_=(0,E.useRef)(0),v=(0,E.useRef)(null),y=(0,E.useRef)(c);y.current=c;let b=(0,E.useCallback)(()=>{if(!t){d(null),h(null),p(!1);return}let e=++_.current;p(!0),h(null);let s=g();if(!s){h(`WebSocket client unavailable`),p(!1);return}v.current?.(),v.current=null;let c=t,l=s.on(`memory.sage.forFile`,t=>{if(e!==_.current)return;let n=t.payload.response;n&&D(n.filePath)!==D(c)||(t.payload.error?(h(t.payload.error),d(null)):(d(n??O),h(null)),p(!1))});v.current=l;let u={filePath:t,limit:i,showSuperseded:a,showDeleted:o,...n===void 0?{}:{lineStart:n},...r===void 0?{}:{lineEnd:r}};try{s.findMemoriesForFile(u,y.current??void 0)}catch(t){l(),v.current===l&&(v.current=null),e===_.current&&(h(t instanceof Error?t.message:String(t)),p(!1))}},[t,n,r,i,a,o]);(0,E.useEffect)(()=>{if(s)return b(),()=>{_.current++,v.current?.(),v.current=null}},[s,b,l]);let x=(0,E.useCallback)(()=>{b()},[b]);return(0,E.useEffect)(()=>()=>{v.current?.(),v.current=null},[]),{data:u,loading:f,error:m,refetch:x}}var A=u();function j(e){return e>=.9?`bg-success/15 border-success/40`:e>=.7?`bg-info/15 border-info/40`:e>=.4?`bg-warning/10 border-warning/30`:`bg-muted/30 border-border/40`}function M(e){switch(e){case`scope_file`:return`scope: file`;case`scope_symbol`:return`scope: symbol`;case`anchor_file`:return`anchor: file`;case`anchor_symbol`:return`anchor: symbol`;case`anchor_directory`:return`anchor: directory`;case`mention`:return`text mention`}}function N({match:e,cursorBoosted:r,onShowMemory:o,onAcceptDeletion:u,onKeep:f,onUpdate:h,onMarkPermanent:g,onRecover:y,pendingAction:b}){let{t:E}=t(),D=e.memory.status===`deleted`,O=e.memory.status===`superseded`,k=e.pendingReview,N=b!==void 0,P=r===!0;return(0,A.jsxs)(`article`,{className:_(`group relative rounded-md border px-3 py-2 text-sm transition-colors`,j(e.matchStrength),P&&`ring-1 ring-primary/40 ring-offset-0`,D&&`opacity-70`),"data-match-via":e.matchedVia,"data-memory-id":e.memory.id,children:[(0,A.jsx)(`header`,{className:`flex items-start justify-between gap-2`,children:(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide`,children:[(0,A.jsx)(`span`,{className:_(`font-mono`,S(e.memory.kind)),children:w[e.memory.kind]??e.memory.kind}),(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,A.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:M(e.matchedVia)}),P&&(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-primary/15 px-1 py-0.5 font-mono text-primary`,title:E(`activity:memoryManager.anchorCursorHint`),children:[(0,A.jsx)(n,{className:`size-2.5`}),` `,E(`activity:memoryManager.cursorLabel`)]}),k&&(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5 rounded-sm bg-warning/15 px-1 py-0.5 font-mono text-warning`,title:E(`activity:memoryManager.hygieneReviewTitle`,{reason:k.reason,days:k.ageDays}),children:[(0,A.jsx)(a,{className:`size-2.5`}),` `,E(`activity:memoryManager.reviewLabel`)]}),D&&(0,A.jsx)(`span`,{className:`font-mono text-destructive`,children:E(`activity:memoryManager.statusDeleted`)}),O&&!D&&(0,A.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:E(`activity:memoryManager.statusSuperseded`)})]}),(0,A.jsx)(`p`,{className:`mt-1 text-foreground/90`,children:x(e.memory.text,200)}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,A.jsx)(C,{status:e.memory.status}),(0,A.jsx)(`span`,{children:E(`activity:memoryManager.updatedSuffix`,{date:T(e.memory.updatedAt)})})]})]})}),(0,A.jsxs)(`footer`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[D&&y&&(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>y(e.memory.id),className:`h-7 gap-1 border-primary/40 px-2 text-[11px] text-primary hover:bg-primary/10`,title:E(`activity:memoryManager.restoreTitle`),children:[(0,A.jsx)(m,{className:`size-3`}),` `,E(`activity:memoryManager.actionRecover`)]}),O&&e.supersededByActiveId&&o&&(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>o(e.supersededByActiveId),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.supersededJumpTitle`),children:[(0,A.jsx)(i,{className:`size-3`}),` `,E(`activity:memoryManager.actionGoToActive`)]}),k&&(u||f||h||g)&&(0,A.jsxs)(A.Fragment,{children:[k.suggestedAction===`delete`&&(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`destructive`,disabled:N,onClick:()=>u?.(k.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.acceptSuggestionTitle`),children:[(0,A.jsx)(p,{className:`size-3`}),` `,E(`activity:memoryManager.actionAcceptDeletion`)]}),(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>f?.(k.candidateId,e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.rejectSuggestionTitle`),children:[(0,A.jsx)(c,{className:`size-3`}),` `,E(`activity:memoryManager.actionKeep`)]}),(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>h?.(e.memory.id),className:`h-7 gap-1 px-2 text-[11px]`,title:E(`activity:memoryManager.updateTitle`),children:[(0,A.jsx)(s,{className:`size-3`}),` `,E(`activity:memoryManager.actionUpdate`)]}),g&&(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`outline`,disabled:N,onClick:()=>g(e.memory.id),className:`h-7 gap-1 border-warning/40 px-2 text-[11px] text-warning hover:bg-warning/10`,title:E(`activity:memoryManager.promoteTitle`),children:[(0,A.jsx)(n,{className:`size-3`}),` `,E(`activity:memoryManager.actionMarkPermanent`)]})]}),o&&!D&&(0,A.jsxs)(v,{type:`button`,size:`sm`,variant:`ghost`,disabled:N,onClick:()=>o(e.memory.id),className:`h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground`,title:E(`activity:memoryManager.openRecordTitle`),children:[(0,A.jsx)(l,{className:`size-3`}),` `,E(`activity:memoryManager.actionShowFull`)]}),b&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,A.jsx)(d,{className:`size-3 animate-spin`}),` `,b]})]})]})}function P({icon:e,title:r,count:i,matches:a,cursorBoosted:o=!1,...s}){let{t:c}=t(),l=b(a,10);return a.length===0?null:(0,A.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-1.5 px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,A.jsx)(e,{className:`size-3`}),(0,A.jsx)(`span`,{children:r}),(0,A.jsxs)(`span`,{className:`font-mono`,children:[`(`,i,`)`]}),o&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 font-mono text-[9px] text-primary`,children:[(0,A.jsx)(n,{className:`size-2.5`}),` `,c(`activity:memoryManager.cursorBoostTitle`)]})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:l.pageItems.map(e=>(0,A.jsx)(N,{match:e,cursorBoosted:o&&(e.matchedVia===`anchor_symbol`||e.matchedVia===`scope_symbol`),pendingAction:s.pendingActionById.get(e.memory.id),...s},e.memory.id))}),(0,A.jsx)(y,{page:l.page,pageSize:l.pageSize,totalItems:l.totalItems,onPageChange:l.setPage,compact:!0,itemLabel:c(`activity:memoryManager.itemLabel`)})]})}function F({filePath:e,lineStart:r,lineEnd:i,open:s,onClose:c,onShowMemory:u,onAcceptDeletion:d,onKeep:p,onUpdate:g,onMarkPermanent:y,onRecover:b}){let{t:x}=t(),[S,C]=(0,E.useState)(!1),[w,T]=(0,E.useState)(new Map),D={accepting:x(`activity:memoryManager.pendingAccepting`),keeping:x(`activity:memoryManager.pendingKeeping`),updating:x(`activity:memoryManager.pendingUpdating`),marking:x(`activity:memoryManager.pendingMarking`),recovering:x(`activity:memoryManager.pendingRecovering`)},{data:O,loading:j,error:M,refetch:N}=k({filePath:e,lineStart:r,lineEnd:i,showDeleted:S,autoFetch:s}),F=r!==void 0&&i!==void 0,L=(0,E.useCallback)(async(e,t,n)=>{if(n){T(n=>new Map(n).set(e,t));try{await n(e)}finally{T(t=>{let n=new Map(t);return n.delete(e),n})}}},[]);if((0,E.useEffect)(()=>{C(!1)},[e]),!s)return null;let R=O,z=R?.totalCount??0;return(0,A.jsxs)(`aside`,{className:`flex h-full min-h-0 w-full flex-col border-l border-border/70 bg-card/15`,"aria-label":x(`activity:memoryManager.fileDrawerAria`),"data-file-path":e??``,children:[(0,A.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3 py-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,A.jsx)(o,{className:`size-3`}),(0,A.jsx)(`span`,{className:`truncate font-mono`,title:e??``,children:e??x(`activity:memoryManager.noFile`)})]}),(0,A.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,A.jsx)(`span`,{className:`font-mono`,children:x(`activity:memoryManager.memoriesCount`,{count:z})}),R&&R.reviewPendingCount>0&&(0,A.jsxs)(`span`,{className:`flex items-center gap-0.5 font-mono text-warning`,children:[(0,A.jsx)(a,{className:`size-3`}),x(`activity:memoryManager.pendingReviewCount`,{count:R.reviewPendingCount})]}),R&&R.supersededCount>0&&(0,A.jsx)(`span`,{className:`font-mono`,children:x(`activity:memoryManager.supersededCount`,{count:R.supersededCount})})]})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,A.jsx)(v,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>N(),disabled:j||!e,className:`h-7 w-7 p-0`,"aria-label":x(`common:action.refresh`),title:x(`activity:memoryManager.requeryTitle`),children:(0,A.jsx)(m,{className:_(`size-3.5`,j&&`animate-spin`)})}),(0,A.jsx)(v,{type:`button`,size:`sm`,variant:`ghost`,onClick:c,className:`h-7 w-7 p-0`,"aria-label":x(`activity:memoryManager.closeDrawerAria`),title:x(`activity:memoryManager.closeDrawerTitle`),children:(0,A.jsx)(h,{className:`size-3.5`})})]})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 bg-background/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,A.jsx)(`input`,{type:`checkbox`,checked:S,onChange:e=>C(e.target.checked),className:`size-3 accent-primary`,disabled:!e,"data-testid":`memory-drawer-show-deleted`}),S?(0,A.jsx)(l,{className:`size-3`}):(0,A.jsx)(f,{className:`size-3`}),(0,A.jsx)(`span`,{children:x(`activity:memoryManager.showRecoverable`)})]}),F&&(0,A.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 font-mono text-[10px] text-primary`,children:[(0,A.jsx)(n,{className:`size-3`}),` `,x(`activity:memoryManager.linesRange`,{start:r,end:i})]})]}),(0,A.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-3 py-3`,children:e?j&&!R?(0,A.jsx)(I,{loading:!0,message:x(`activity:memoryManager.loadingMemories`)}):M?(0,A.jsx)(I,{tone:`error`,message:x(`activity:memoryManager.errorPrefix`,{message:M})}):!R||z===0?(0,A.jsx)(I,{message:x(`activity:memoryManager.emptyNoMemories`,{file:e})}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsx)(P,{icon:n,title:x(`activity:memoryManager.cursorBoostTitle`),count:R.symbolMatches.length,cursorBoosted:F,matches:R.symbolMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>d?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>p?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))}),(0,A.jsx)(P,{icon:o,title:x(`activity:memoryManager.fileScopedTitle`),count:R.primaryMatches.length,matches:R.primaryMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>d?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>p?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))}),(0,A.jsx)(P,{icon:l,title:x(`activity:memoryManager.mentionedInTitle`),count:R.relatedMatches.length,matches:R.relatedMatches,pendingActionById:w,onShowMemory:u,onAcceptDeletion:(e,t)=>L(t,D.accepting,()=>d?.(e,t)),onKeep:(e,t)=>L(t,D.keeping,()=>p?.(e,t)),onUpdate:e=>L(e,D.updating,()=>g?.(e)),onMarkPermanent:e=>L(e,D.marking,()=>y?.(e)),onRecover:e=>L(e,D.recovering,()=>b?.(e))})]}):(0,A.jsx)(I,{message:x(`activity:memoryManager.emptyOpenFile`)})})]})}function I({message:e,loading:t=!1,tone:n=`default`}){return(0,A.jsxs)(`div`,{className:_(`flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border/60 px-4 py-6 text-center text-[11px]`,n===`error`?`text-destructive`:`text-muted-foreground`),children:[t&&(0,A.jsx)(d,{className:`size-4 animate-spin`}),(0,A.jsx)(`p`,{children:e})]})}export{F as t};
|