@wrongstack/webui 0.297.0 → 0.298.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AgentRosterView-C26RCdot.js +11 -0
- package/dist/assets/{AnalyticsDashboard-CkceglT6.js → AnalyticsDashboard-CEjjV3bX.js} +1 -1
- package/dist/assets/AudienceMemoryPanel-CnfZC8x0.js +3 -0
- package/dist/assets/{ChangesView-DouwIaDk.js → ChangesView-D0BiTbs8.js} +1 -1
- package/dist/assets/ChronicleDashboard-BZ4XOcvf.js +1 -0
- package/dist/assets/CodeEditor-BlqaT56D.js +1 -0
- package/dist/assets/CodeMap-Bj5tjjW5.js +1 -0
- package/dist/assets/{CronJobsPanel-CAImDL8t.js → CronJobsPanel-F6nhZtfg.js} +1 -1
- package/dist/assets/DeadCodeScanPanel-C9sLNUUc.js +2 -0
- package/dist/assets/{DebugDashboard-DLNPZIEI.js → DebugDashboard-D8BLcLjI.js} +1 -1
- package/dist/assets/{DesignGalleryView-D0azMq2e.js → DesignGalleryView-B8mE5nGy.js} +1 -1
- package/dist/assets/GoalView-DIx7Zr4a.js +1 -0
- package/dist/assets/KanbanView-DshzDwq1.js +3 -0
- package/dist/assets/MailboxDetailView-BJXpXjtm.js +1 -0
- package/dist/assets/MemoryManager-B-S5oREO.js +1 -0
- package/dist/assets/{ModelPicker-CN-UD3lc.js → ModelPicker-CNHhT2SO.js} +1 -1
- package/dist/assets/OfficeMapPanel-CBN9uG80.js +4 -0
- package/dist/assets/{ProcessMonitor-ButM8C0T.js → ProcessMonitor-Cc8LsfTh.js} +1 -1
- package/dist/assets/QueuePanel-B0NXFwEt.js +1 -0
- package/dist/assets/{RefreshDebugView-DVvWsh9A.js → RefreshDebugView-DLst_piS.js} +1 -1
- package/dist/assets/SageTabs-NwMcr4Pq.js +2 -0
- package/dist/assets/SddHub-CpRHXmjm.js +2 -0
- package/dist/assets/SessionsDashboard-C5dXb0iJ.js +1 -0
- package/dist/assets/SetupScreen-B81fcNgP.js +1 -0
- package/dist/assets/SkillDetailView-BTvgE_MD.js +3 -0
- package/dist/assets/{SpecsView-BJs_okSx.js → SpecsView-DhuaZcOl.js} +1 -1
- package/dist/assets/TechStackView-BXmfl2qY.js +1 -0
- package/dist/assets/{TerminalPanel-W2V0X7b9.js → TerminalPanel-DjruTcb6.js} +1 -1
- package/dist/assets/{Toaster-CbcX_Cou.js → Toaster-BmyghnqJ.js} +1 -1
- package/dist/assets/{activity-CbbZyUMG.js → activity-Bo6DncWg.js} +1 -1
- package/dist/assets/{activity-C4z6-WoZ.js → activity-C34aPcFU.js} +1 -1
- package/dist/assets/{activity-B4Ngvkan.js → activity-CBdzUJQ_.js} +1 -1
- package/dist/assets/{activity-B8uejnae.js → activity-CLYyxeC6.js} +1 -1
- package/dist/assets/{activity-qoJ3grs0.js → activity-Cv_EIWjY.js} +1 -1
- package/dist/assets/{activity-B5MvPWYV.js → activity-Wr0_Gb8A.js} +1 -1
- package/dist/assets/{activity-D57y5l1T.js → activity-kCY0dGRC.js} +1 -1
- package/dist/assets/{button-uGqXvobk.js → button-BMECp1cg.js} +1 -1
- package/dist/assets/{chat-Du7n7HZ7.js → chat-CRmMDzCb.js} +1 -1
- package/dist/assets/{chat-VkTBQmmx.js → chat-CwnuX7tG.js} +1 -1
- package/dist/assets/{chat-BJzPxfyr.js → chat-DLn1hY01.js} +1 -1
- package/dist/assets/{chat-IRKmQ6we.js → chat-DSEq1Bdz.js} +1 -1
- package/dist/assets/{chat-C7ybebfi.js → chat-DxLD17ER.js} +1 -1
- package/dist/assets/{chat-BRBVFl4h.js → chat-DzPxYALH.js} +1 -1
- package/dist/assets/{chat-Bkom8vQo.js → chat-OunddzYy.js} +1 -1
- package/dist/assets/chat-store-B2CjP2Zl.js +17 -0
- package/dist/assets/{codemap-activity-store-DP3mCZu1.js → codemap-activity-store-Cz0_AHqt.js} +1 -1
- package/dist/assets/codemap-index-store-B-XLZpJu.js +1 -0
- package/dist/assets/common-BfVFjVhf.js +1 -0
- package/dist/assets/common-C5hY-d_0.js +1 -0
- package/dist/assets/{dialog-CT1PTjzK.js → dialog-BJef9ZZo.js} +1 -1
- package/dist/assets/{empty-state-CdyXy96A.js → empty-state-BGzRrNXI.js} +1 -1
- package/dist/assets/{i18n-1BkaqMgr.js → i18n-2wGPPdl_.js} +2 -2
- package/dist/assets/index-DeA8UyiB.css +1 -0
- package/dist/assets/index-x6-rLl5H.js +132 -0
- package/dist/assets/{input-B-VCX2sG.js → input-Bd10nfMj.js} +1 -1
- package/dist/assets/{mailbox-store-DVoNbOZr.js → mailbox-store-D3omLzBk.js} +1 -1
- package/dist/assets/markdown-sSmz-Ua_.js +44 -0
- package/dist/assets/progress-ring-BEULkQ1r.js +1 -0
- package/dist/assets/{roster-ws-DXm0krqH.js → roster-ws-BmV_3U6w.js} +1 -1
- package/dist/assets/session-store-ZMNU48xK.js +1 -0
- package/dist/assets/settings-BF0lRxlj.js +1 -0
- package/dist/assets/settings-CP6cwqHD.js +1 -0
- package/dist/assets/settings-D0rWEhMg.js +1 -0
- package/dist/assets/settings-DFCaP02p.js +1 -0
- package/dist/assets/settings-DHix1ZPL.js +1 -0
- package/dist/assets/{settings-DEmKlLmn.js → settings-eEzjNzsC.js} +1 -1
- package/dist/assets/settings-kp_aIgcX.js +1 -0
- package/dist/assets/{shared-jvJxtKc5.js → shared-CrX8iE-U.js} +1 -1
- package/dist/assets/stores-DyQOSkkD.js +7 -0
- package/dist/assets/ui-store-di6oY7cy.js +1 -0
- package/dist/assets/useWebSocket-BVFPigcY.js +28 -0
- package/dist/assets/{utils-CN2sfDVP.js → utils-CwJvjOcH.js} +1 -1
- package/dist/assets/{vendor-2VBBgNb5.js → vendor-BTTkQ9Tn.js} +28 -28
- package/dist/assets/{view-navigation-Cgy5xh9q.js → view-navigation-BMRzqGbq.js} +1 -1
- package/dist/assets/ws-client-B0-KwuTK.js +1 -0
- package/dist/components/ChatInput/refine-panel-host.d.ts +9 -1
- package/dist/components/DeadCodeScanPanel/DeadCodeScanPanel.d.ts +1 -3
- package/dist/components/MemoryManager/MemoryInjectorPanel.d.ts +19 -0
- package/dist/components/PanelSuspense.d.ts +8 -0
- package/dist/components/SettingsPanel/DisplaySection.d.ts +20 -0
- package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -1
- package/dist/components/ViewRouter.d.ts +12 -0
- package/dist/components/WorkbenchTopbar.d.ts +53 -0
- package/dist/components/codemap-model.d.ts +2 -0
- package/dist/hooks/useViewport.d.ts +38 -0
- package/dist/hooks/useWebSocket.d.ts +1 -0
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +1 -0
- package/dist/index.html +25 -26
- package/dist/index.js +58857 -57378
- package/dist/lib/sage-block.d.ts +18 -23
- package/dist/lib/view-navigation.d.ts +1 -1
- package/dist/lib/ws-client.d.ts +16 -8
- package/dist/providers.json +10 -0
- package/dist/stores/chat-store.d.ts +36 -3
- package/dist/stores/config-store.d.ts +0 -2
- package/dist/stores/local-prefs.d.ts +22 -2
- package/dist/stores/session-store.d.ts +3 -0
- package/dist/stores/types.d.ts +2 -1
- package/dist/stores/ui-store.d.ts +8 -1
- package/dist/types/client-message.d.ts +1 -0
- package/dist/types/connections.d.ts +7 -1
- package/dist/types/server-message.d.ts +11 -0
- package/dist/types/system.d.ts +4 -0
- package/package.json +11 -9
- package/dist/App.d.ts.map +0 -1
- package/dist/assets/AgentRosterView-Cje2NBtU.js +0 -11
- package/dist/assets/AudienceMemoryPanel-DB-8ISNP.js +0 -3
- package/dist/assets/ChronicleDashboard-B4Khm6hu.js +0 -1
- package/dist/assets/CodeEditor-CrKbA5s8.js +0 -1
- package/dist/assets/CodeMap-Dz8yNlUe.js +0 -1
- package/dist/assets/DeadCodeScanPanel-C5ehBTQF.js +0 -2
- package/dist/assets/GoalView-gtQRK78W.js +0 -1
- package/dist/assets/KanbanView-BXKe19EI.js +0 -3
- package/dist/assets/LazyMarkdown-BGwFjYKr.js +0 -3
- package/dist/assets/MailboxDetailView-D4fXipos.js +0 -1
- package/dist/assets/MemoryManager-D_rquas9.js +0 -1
- package/dist/assets/OfficeMapPanel-CJFrTNmg.js +0 -4
- package/dist/assets/QueuePanel-C5oihwYM.js +0 -1
- package/dist/assets/SageTabs-C9vAgvCD.js +0 -2
- package/dist/assets/SddHub-D_nsWjuM.js +0 -2
- package/dist/assets/SessionsDashboard-DdwU3Ma5.js +0 -1
- package/dist/assets/SetupScreen-CQCfLdPI.js +0 -1
- package/dist/assets/SkillDetailView-mVxi-9jo.js +0 -3
- package/dist/assets/TechStackView-BZ4M7TYc.js +0 -1
- package/dist/assets/chat-store-CM1dMeuY.js +0 -17
- package/dist/assets/codemap-index-store-DyAe3ZYJ.js +0 -1
- package/dist/assets/common-D8_r1x8x.js +0 -1
- package/dist/assets/common-suUxW9sA.js +0 -1
- package/dist/assets/index-BPfIz78e.js +0 -131
- package/dist/assets/index-BlceaIyu.css +0 -1
- package/dist/assets/markdown-L6DLSM7f.js +0 -44
- package/dist/assets/progress-ring-CFOvGxw7.js +0 -1
- package/dist/assets/session-store-BsNYnfOc.js +0 -1
- package/dist/assets/settings-C5F2tQ7C.js +0 -1
- package/dist/assets/settings-Cdk8i_p6.js +0 -1
- package/dist/assets/settings-D6wFOw5n.js +0 -1
- package/dist/assets/settings-DCEOkxYE.js +0 -1
- package/dist/assets/settings-DsflqNn0.js +0 -1
- package/dist/assets/settings-skShEZ2B.js +0 -1
- package/dist/assets/stores-mpa0202y.js +0 -6
- package/dist/assets/ui-store-CS-njcmT.js +0 -1
- package/dist/assets/useWebSocket-Dh3aAFDE.js +0 -28
- package/dist/assets/ws-client-WVGn8ORh.js +0 -1
- package/dist/components/AgentOfficeDetails.d.ts.map +0 -1
- package/dist/components/AgentOfficeView/model.d.ts.map +0 -1
- package/dist/components/AgentOfficeView.d.ts.map +0 -1
- package/dist/components/AgentRosterCatalogTab.d.ts.map +0 -1
- package/dist/components/AgentRosterChrome.d.ts.map +0 -1
- package/dist/components/AgentRosterLiveTab.d.ts.map +0 -1
- package/dist/components/AgentRosterSelfLearningTab.d.ts.map +0 -1
- package/dist/components/AgentRosterView.d.ts.map +0 -1
- package/dist/components/AgentRuntimePolicyEditor.d.ts.map +0 -1
- package/dist/components/AgentTranscript.d.ts.map +0 -1
- package/dist/components/AgentsMonitor.d.ts.map +0 -1
- package/dist/components/AgentsPage/format.d.ts.map +0 -1
- package/dist/components/AgentsPage.d.ts.map +0 -1
- package/dist/components/AnalyticsDashboard.d.ts.map +0 -1
- package/dist/components/AudienceMemoryPanel.d.ts.map +0 -1
- package/dist/components/AutonomyPicker.d.ts.map +0 -1
- package/dist/components/AvailabilityCalendarEditor.d.ts.map +0 -1
- package/dist/components/BoardView.d.ts.map +0 -1
- package/dist/components/ChangesView.d.ts.map +0 -1
- package/dist/components/ChatInput/code-detect.d.ts.map +0 -1
- package/dist/components/ChatInput/draft-token-counter.d.ts.map +0 -1
- package/dist/components/ChatInput/file-mention-picker.d.ts.map +0 -1
- package/dist/components/ChatInput/image-attach-control.d.ts.map +0 -1
- package/dist/components/ChatInput/image-attachments.d.ts.map +0 -1
- package/dist/components/ChatInput/queued-messages.d.ts.map +0 -1
- package/dist/components/ChatInput/refine-panel-host.d.ts.map +0 -1
- package/dist/components/ChatInput/slash-commands.d.ts.map +0 -1
- package/dist/components/ChatInput/slash-popup.d.ts.map +0 -1
- package/dist/components/ChatInput/slash-routing.d.ts.map +0 -1
- package/dist/components/ChatInput/stop-controls.d.ts.map +0 -1
- package/dist/components/ChatInput/use-paste-drop.d.ts.map +0 -1
- package/dist/components/ChatInput.d.ts.map +0 -1
- package/dist/components/ChatView/ThinkingBubble.d.ts.map +0 -1
- package/dist/components/ChatView/index.d.ts.map +0 -1
- package/dist/components/ChatView/utils.d.ts.map +0 -1
- package/dist/components/ChatView.d.ts.map +0 -1
- package/dist/components/CheckpointTimeline.d.ts.map +0 -1
- package/dist/components/ChipMultiSelect.d.ts.map +0 -1
- package/dist/components/ChronicleDashboard.d.ts.map +0 -1
- package/dist/components/ChroniclePipelineStrip.d.ts.map +0 -1
- package/dist/components/CodeEditor.d.ts.map +0 -1
- package/dist/components/CodeMap.d.ts.map +0 -1
- package/dist/components/CodeMapActivityDrawer.d.ts.map +0 -1
- package/dist/components/CodeMapActivityHelpers.d.ts.map +0 -1
- package/dist/components/CodeMapActivityStreamPanel.d.ts.map +0 -1
- package/dist/components/CodeMapCanvasSurface.d.ts.map +0 -1
- package/dist/components/CodeMapCanvasToolbar.d.ts.map +0 -1
- package/dist/components/CodeMapConfig.d.ts.map +0 -1
- package/dist/components/CodeMapDirectoryTree.d.ts.map +0 -1
- package/dist/components/CodeMapFlowState.d.ts.map +0 -1
- package/dist/components/CodeMapHeader.d.ts.map +0 -1
- package/dist/components/CodeMapLiveOverlay.d.ts.map +0 -1
- package/dist/components/CodeMapRelationInspector.d.ts.map +0 -1
- package/dist/components/CodeMapRelations.d.ts.map +0 -1
- package/dist/components/CodeMapSearchResults.d.ts.map +0 -1
- package/dist/components/CodeMapSelectedNodeSummary.d.ts.map +0 -1
- package/dist/components/CodeMapTreeSidebar.d.ts.map +0 -1
- package/dist/components/CodeMapVisuals.d.ts.map +0 -1
- package/dist/components/CollabPanel.d.ts.map +0 -1
- package/dist/components/CommandPalette/export-utils.d.ts.map +0 -1
- package/dist/components/CommandPalette/index.d.ts.map +0 -1
- package/dist/components/CommandPalette.d.ts.map +0 -1
- package/dist/components/ConfirmDialog.d.ts.map +0 -1
- package/dist/components/ConfirmModal.d.ts.map +0 -1
- package/dist/components/ConnectionBanner.d.ts.map +0 -1
- package/dist/components/ContextBar.d.ts.map +0 -1
- package/dist/components/ContextBreakdownModal.d.ts.map +0 -1
- package/dist/components/ContextDashboard.d.ts.map +0 -1
- package/dist/components/ContextMemoryMonitor.d.ts.map +0 -1
- package/dist/components/ContextModePicker.d.ts.map +0 -1
- package/dist/components/CostChip.d.ts.map +0 -1
- package/dist/components/CronJobsPanel.d.ts.map +0 -1
- package/dist/components/CronTrigger.d.ts.map +0 -1
- package/dist/components/CustomRosterPanel.d.ts.map +0 -1
- package/dist/components/DeadCodeScanPanel/DeadCodeScanPanel.d.ts.map +0 -1
- package/dist/components/DebugDashboard.d.ts.map +0 -1
- package/dist/components/DependencyGraph.d.ts.map +0 -1
- package/dist/components/DesignGalleryView.d.ts.map +0 -1
- package/dist/components/DiffView.d.ts.map +0 -1
- package/dist/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackEditor.d.ts.map +0 -1
- package/dist/components/FileActivityDrawer.d.ts.map +0 -1
- package/dist/components/FileExplorer.d.ts.map +0 -1
- package/dist/components/FilePicker.d.ts.map +0 -1
- package/dist/components/FileReferenceChip.d.ts.map +0 -1
- package/dist/components/FleetMonitor.d.ts.map +0 -1
- package/dist/components/FleetPanel.d.ts.map +0 -1
- package/dist/components/GoalPanel.d.ts.map +0 -1
- package/dist/components/GoalView.d.ts.map +0 -1
- package/dist/components/InspectorPanel.d.ts.map +0 -1
- package/dist/components/KanbanAgentRunPanel.d.ts.map +0 -1
- package/dist/components/KanbanBoardChrome.d.ts.map +0 -1
- package/dist/components/KanbanBoardSidebar.d.ts.map +0 -1
- package/dist/components/KanbanBoardState.d.ts.map +0 -1
- package/dist/components/KanbanBoundaryEditor.d.ts.map +0 -1
- package/dist/components/KanbanCleanerAlert.d.ts.map +0 -1
- package/dist/components/KanbanColumnView.d.ts.map +0 -1
- package/dist/components/KanbanDecompositionPanel.d.ts.map +0 -1
- package/dist/components/KanbanQueueHealthBar.d.ts.map +0 -1
- package/dist/components/KanbanRunControls.d.ts.map +0 -1
- package/dist/components/KanbanTaskActivityRecorder.d.ts.map +0 -1
- package/dist/components/KanbanTaskCompletionChecks.d.ts.map +0 -1
- package/dist/components/KanbanTaskFields.d.ts.map +0 -1
- package/dist/components/KanbanTaskInspector.d.ts.map +0 -1
- package/dist/components/KanbanTaskOptions.d.ts.map +0 -1
- package/dist/components/KanbanTaskTree.d.ts.map +0 -1
- package/dist/components/KanbanVerificationDashboard.d.ts.map +0 -1
- package/dist/components/KanbanView.d.ts.map +0 -1
- package/dist/components/KanbanViewModeTabs.d.ts.map +0 -1
- package/dist/components/MailboxDetailView.d.ts.map +0 -1
- package/dist/components/MailboxPanel.d.ts.map +0 -1
- package/dist/components/MemoryManager/DeleteMemoryDialog.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryDetail.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryDrawer.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryEditor.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryFilters.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryGraph.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryInjectorTrace.d.ts +0 -3
- package/dist/components/MemoryManager/MemoryInjectorTrace.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryLifecycleTrace.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryList.d.ts.map +0 -1
- package/dist/components/MemoryManager/MemoryManagerEmpty.d.ts.map +0 -1
- package/dist/components/MemoryManager/SageTabs.d.ts.map +0 -1
- package/dist/components/MemoryManager/index.d.ts.map +0 -1
- package/dist/components/MemoryManager/selectors.d.ts.map +0 -1
- package/dist/components/MemoryManager/shared.d.ts.map +0 -1
- package/dist/components/MessageBubble/AttachmentGallery.d.ts.map +0 -1
- package/dist/components/MessageBubble/CopyButton.d.ts.map +0 -1
- package/dist/components/MessageBubble/ErrorBody.d.ts.map +0 -1
- package/dist/components/MessageBubble/LazyMarkdown.d.ts.map +0 -1
- package/dist/components/MessageBubble/StreamingMarkdown.d.ts.map +0 -1
- package/dist/components/MessageBubble/ToolInputView.d.ts.map +0 -1
- package/dist/components/MessageBubble/ToolLedgerCard.d.ts.map +0 -1
- package/dist/components/MessageBubble/index.d.ts.map +0 -1
- package/dist/components/MessageBubble/utils.d.ts.map +0 -1
- package/dist/components/MessageBubble.d.ts.map +0 -1
- package/dist/components/ModePicker.d.ts.map +0 -1
- package/dist/components/ModelPickDialog.d.ts.map +0 -1
- package/dist/components/ModelPicker.d.ts.map +0 -1
- package/dist/components/ModelSelectDialog.d.ts.map +0 -1
- package/dist/components/MonacoDiffView.d.ts.map +0 -1
- package/dist/components/NextStepsBar.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/CanvasPanels.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/Hud.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/Overlays.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/SelectedNodeDetailPanel.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/edges.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/nodes.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/resolve.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/use-recently-finished.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas/utils.d.ts.map +0 -1
- package/dist/components/OfficeMapCanvas.d.ts.map +0 -1
- package/dist/components/OfficeMapPanel.d.ts.map +0 -1
- package/dist/components/OfficeMapSettingsPanel.d.ts.map +0 -1
- package/dist/components/PhasePanel.d.ts.map +0 -1
- package/dist/components/PlanPanel.d.ts.map +0 -1
- package/dist/components/ProcessMonitor.d.ts.map +0 -1
- package/dist/components/PromptLibraryModal.d.ts.map +0 -1
- package/dist/components/ProviderWaitingRoom.d.ts.map +0 -1
- package/dist/components/QueuePanel.d.ts.map +0 -1
- package/dist/components/QuickModelSwitcher.d.ts.map +0 -1
- package/dist/components/QuickModelSwitcher.filter.d.ts.map +0 -1
- package/dist/components/RefinePanel.d.ts.map +0 -1
- package/dist/components/RefreshDebugView.d.ts.map +0 -1
- package/dist/components/SageMemoryCard.d.ts +0 -19
- package/dist/components/SageMemoryCard.d.ts.map +0 -1
- package/dist/components/SddActivityFeed.d.ts.map +0 -1
- package/dist/components/SddBoardView.d.ts.map +0 -1
- package/dist/components/SddDestroyDialog.d.ts.map +0 -1
- package/dist/components/SddFlowGraph.d.ts.map +0 -1
- package/dist/components/SddHub.d.ts.map +0 -1
- package/dist/components/SddKanbanView.d.ts.map +0 -1
- package/dist/components/SddTaskDrawer.d.ts.map +0 -1
- package/dist/components/SddWizard.d.ts.map +0 -1
- package/dist/components/SearchOverlay.d.ts.map +0 -1
- package/dist/components/SendButton.d.ts.map +0 -1
- package/dist/components/SessionWatchPanel.d.ts.map +0 -1
- package/dist/components/SessionsDashboard.d.ts.map +0 -1
- package/dist/components/SettingsPanel/BasicSettingsTabs.d.ts.map +0 -1
- package/dist/components/SettingsPanel/BrainSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ChimeraSettingsPanel.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ClearAllowlistDialog.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ConnectionsHealthSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/FallbacksSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/FleetSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/IntegrationsSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/MCPSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ModelSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/OAuthLoginSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/PluginToggleList.d.ts.map +0 -1
- package/dist/components/SettingsPanel/PreferenceControls.d.ts.map +0 -1
- package/dist/components/SettingsPanel/PreferenceToggle.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ProviderModelsPanel.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ProviderModelsPanel.filter.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ProviderSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/RoutingSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/SecuritySection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ShadowSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/ToolsSection.d.ts.map +0 -1
- package/dist/components/SettingsPanel/brain-section-options.d.ts.map +0 -1
- package/dist/components/SettingsPanel/index.d.ts.map +0 -1
- package/dist/components/SettingsPanel/local-presets.d.ts.map +0 -1
- package/dist/components/SettingsPanel/official-servers.d.ts.map +0 -1
- package/dist/components/SettingsPanel/settings-panel-reducers.d.ts.map +0 -1
- package/dist/components/SettingsPanel/undo-send-decision.d.ts.map +0 -1
- package/dist/components/SettingsPanel.d.ts.map +0 -1
- package/dist/components/SetupScreen/CustomProviderSection.d.ts.map +0 -1
- package/dist/components/SetupScreen/ModelEditor.d.ts.map +0 -1
- package/dist/components/SetupScreen/ProviderKeyCard.d.ts.map +0 -1
- package/dist/components/SetupScreen/key-operation.d.ts.map +0 -1
- package/dist/components/SetupScreen/popular-providers.d.ts.map +0 -1
- package/dist/components/SetupScreen/relative-time.d.ts.map +0 -1
- package/dist/components/SetupScreen/types.d.ts.map +0 -1
- package/dist/components/SetupScreen.d.ts.map +0 -1
- package/dist/components/ShortcutsOverlay.d.ts.map +0 -1
- package/dist/components/SideEffectTimeline.d.ts.map +0 -1
- package/dist/components/SidePanel/AgentsPanel.d.ts.map +0 -1
- package/dist/components/SidePanel/ChangesPanel.d.ts.map +0 -1
- package/dist/components/SidePanel/DesignStudioPanel.d.ts.map +0 -1
- package/dist/components/SidePanel/SessionList.d.ts.map +0 -1
- package/dist/components/SidePanel/SessionPanel.d.ts.map +0 -1
- package/dist/components/SidePanel/SkillsList.d.ts.map +0 -1
- package/dist/components/SidePanel/WorktreesPanel.d.ts.map +0 -1
- package/dist/components/SidePanel/index.d.ts.map +0 -1
- package/dist/components/SkillDetailView.d.ts.map +0 -1
- package/dist/components/SpecsView.d.ts.map +0 -1
- package/dist/components/TaskActivityTimeline.d.ts.map +0 -1
- package/dist/components/TaskBoard.d.ts.map +0 -1
- package/dist/components/TaskCard.d.ts.map +0 -1
- package/dist/components/TaskExecutionAttempts.d.ts.map +0 -1
- package/dist/components/TaskIntelligencePanel.d.ts.map +0 -1
- package/dist/components/TaskRiskPanel.d.ts.map +0 -1
- package/dist/components/TaskVerificationSection.d.ts.map +0 -1
- package/dist/components/TasksPanel.d.ts.map +0 -1
- package/dist/components/TechStackView/DependencyDetail.d.ts.map +0 -1
- package/dist/components/TechStackView/DependencyTable.d.ts.map +0 -1
- package/dist/components/TechStackView/FindingsPanel.d.ts.map +0 -1
- package/dist/components/TechStackView/TechStackToolbar.d.ts.map +0 -1
- package/dist/components/TechStackView/index.d.ts.map +0 -1
- package/dist/components/TechStackView/shared.d.ts.map +0 -1
- package/dist/components/TerminalPanel.d.ts.map +0 -1
- package/dist/components/ThemeProvider.d.ts.map +0 -1
- package/dist/components/Toaster.d.ts.map +0 -1
- package/dist/components/TodosPanel.d.ts.map +0 -1
- package/dist/components/ToolGroup.d.ts.map +0 -1
- package/dist/components/ToolResult.d.ts.map +0 -1
- package/dist/components/UpdateBanner.d.ts.map +0 -1
- package/dist/components/VerificationReportPanel.d.ts.map +0 -1
- package/dist/components/WatchMessageBubble.d.ts.map +0 -1
- package/dist/components/WelcomeScreen.d.ts.map +0 -1
- package/dist/components/WorkDashboard.d.ts.map +0 -1
- package/dist/components/WorkspaceDock.d.ts.map +0 -1
- package/dist/components/WorktreeGraph.d.ts.map +0 -1
- package/dist/components/WorktreeLanes.d.ts.map +0 -1
- package/dist/components/WorktreeOrphans.d.ts.map +0 -1
- package/dist/components/activity-bar/index.d.ts.map +0 -1
- package/dist/components/activity-bar/nav.d.ts.map +0 -1
- package/dist/components/agent-roster-data.d.ts.map +0 -1
- package/dist/components/agents/AgentDetailSection.d.ts.map +0 -1
- package/dist/components/agents/AgentRosterCard.d.ts.map +0 -1
- package/dist/components/agents/FleetSummaryBar.d.ts.map +0 -1
- package/dist/components/codemap-model.d.ts.map +0 -1
- package/dist/components/context-editor/ContextWindowEditor.d.ts.map +0 -1
- package/dist/components/dashboard-primitives.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/monaco-theme.d.ts.map +0 -1
- package/dist/components/toaster-helpers.d.ts.map +0 -1
- package/dist/components/ui/PickerCardList.d.ts.map +0 -1
- package/dist/components/ui/api-key-display.d.ts.map +0 -1
- package/dist/components/ui/badge.d.ts.map +0 -1
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/concurrency-gauge.d.ts.map +0 -1
- package/dist/components/ui/dialog.d.ts.map +0 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/components/ui/empty-state.d.ts.map +0 -1
- package/dist/components/ui/event-timeline.d.ts.map +0 -1
- package/dist/components/ui/fleet-agent-row.d.ts.map +0 -1
- package/dist/components/ui/index.d.ts.map +0 -1
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/pagination.d.ts.map +0 -1
- package/dist/components/ui/progress-ring.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/sheet.d.ts.map +0 -1
- package/dist/components/ui/sparkline.d.ts.map +0 -1
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/useAgentRosterData.d.ts.map +0 -1
- package/dist/components/useKanbanRegistrySessionIds.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/use-ws-handlers.d.ts.map +0 -1
- package/dist/hooks/useDesktopBridge.d.ts.map +0 -1
- package/dist/hooks/useF5Resilience.d.ts.map +0 -1
- package/dist/hooks/useFieldKeyboardNav.d.ts.map +0 -1
- package/dist/hooks/useFleetPolling.d.ts.map +0 -1
- package/dist/hooks/useGitInfo.d.ts.map +0 -1
- package/dist/hooks/useGlobalKeyboardShortcuts.d.ts.map +0 -1
- package/dist/hooks/useHorizontalScroll.d.ts.map +0 -1
- package/dist/hooks/useKanbanMeta.d.ts.map +0 -1
- package/dist/hooks/useMemoryForFile.d.ts.map +0 -1
- package/dist/hooks/usePagination.d.ts.map +0 -1
- package/dist/hooks/useProviderModels.d.ts.map +0 -1
- package/dist/hooks/useScrollPosition.d.ts.map +0 -1
- package/dist/hooks/useWebSocket.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/chat-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/coordinator-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/fleet-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/misc-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/session-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers/techstack-handlers.d.ts.map +0 -1
- package/dist/hooks/ws-handlers.d.ts.map +0 -1
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/languages.d.ts.map +0 -1
- package/dist/index.css.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/lib/accent-colors.d.ts.map +0 -1
- package/dist/lib/agent-office.d.ts.map +0 -1
- package/dist/lib/agent-status.d.ts.map +0 -1
- package/dist/lib/chime.d.ts.map +0 -1
- package/dist/lib/color.d.ts.map +0 -1
- package/dist/lib/completion.d.ts.map +0 -1
- package/dist/lib/core-browser-shim.d.ts.map +0 -1
- package/dist/lib/default-prompt-pools.d.ts.map +0 -1
- package/dist/lib/desktop-host.d.ts.map +0 -1
- package/dist/lib/desktop-shell.d.ts.map +0 -1
- package/dist/lib/fallback-ref.d.ts.map +0 -1
- package/dist/lib/favicon.d.ts.map +0 -1
- package/dist/lib/file-icons.d.ts.map +0 -1
- package/dist/lib/goal.d.ts.map +0 -1
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/kanban-cleaner.d.ts.map +0 -1
- package/dist/lib/kanban-metadata.d.ts.map +0 -1
- package/dist/lib/kanban-verification.d.ts.map +0 -1
- package/dist/lib/model-calendar.d.ts.map +0 -1
- package/dist/lib/model-matrix-routes.d.ts.map +0 -1
- package/dist/lib/notify.d.ts.map +0 -1
- package/dist/lib/plugin-enablement.d.ts.map +0 -1
- package/dist/lib/roster-ws.d.ts.map +0 -1
- package/dist/lib/sage-block.d.ts.map +0 -1
- package/dist/lib/sdd-theme.d.ts.map +0 -1
- package/dist/lib/stream-coalescer.d.ts.map +0 -1
- package/dist/lib/terminal-dock.d.ts.map +0 -1
- package/dist/lib/tool-icon.d.ts.map +0 -1
- package/dist/lib/tool-summary.d.ts.map +0 -1
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/view-navigation.d.ts.map +0 -1
- package/dist/lib/ws-client-actions.d.ts.map +0 -1
- package/dist/lib/ws-client-contracts.d.ts.map +0 -1
- package/dist/lib/ws-client-helpers.d.ts.map +0 -1
- package/dist/lib/ws-client-utils.d.ts.map +0 -1
- package/dist/lib/ws-client.d.ts.map +0 -1
- package/dist/main.d.ts.map +0 -1
- package/dist/protocol-compatibility.d.ts.map +0 -1
- package/dist/stores/auto-submit-streak.d.ts.map +0 -1
- package/dist/stores/chat-store.d.ts.map +0 -1
- package/dist/stores/codemap-activity-store.d.ts.map +0 -1
- package/dist/stores/codemap-index-store.d.ts.map +0 -1
- package/dist/stores/config-store.d.ts.map +0 -1
- package/dist/stores/context-editor-store.d.ts.map +0 -1
- package/dist/stores/coordinator-monitor-store.d.ts.map +0 -1
- package/dist/stores/cron-store.d.ts.map +0 -1
- package/dist/stores/file-reference-store.d.ts.map +0 -1
- package/dist/stores/file-store.d.ts.map +0 -1
- package/dist/stores/fleet-store.d.ts.map +0 -1
- package/dist/stores/git-changes-store.d.ts.map +0 -1
- package/dist/stores/git-info-store.d.ts.map +0 -1
- package/dist/stores/goal-assess-store.d.ts.map +0 -1
- package/dist/stores/goal-run-store.d.ts.map +0 -1
- package/dist/stores/goal-state-store.d.ts.map +0 -1
- package/dist/stores/goal-store.d.ts.map +0 -1
- package/dist/stores/history-store.d.ts.map +0 -1
- package/dist/stores/index.d.ts.map +0 -1
- package/dist/stores/kanban-store.d.ts.map +0 -1
- package/dist/stores/local-prefs.d.ts.map +0 -1
- package/dist/stores/mailbox-store.d.ts.map +0 -1
- package/dist/stores/memory-injector-store.d.ts.map +0 -1
- package/dist/stores/memory-lifecycle-store.d.ts.map +0 -1
- package/dist/stores/monitor-store.d.ts.map +0 -1
- package/dist/stores/office-map-store.d.ts.map +0 -1
- package/dist/stores/provider-status-store.d.ts.map +0 -1
- package/dist/stores/sdd-board-store.d.ts.map +0 -1
- package/dist/stores/sdd-wizard-store.d.ts.map +0 -1
- package/dist/stores/session-store.d.ts.map +0 -1
- package/dist/stores/side-effect-store.d.ts.map +0 -1
- package/dist/stores/specs-store.d.ts.map +0 -1
- package/dist/stores/techstack-store.d.ts.map +0 -1
- package/dist/stores/types.d.ts.map +0 -1
- package/dist/stores/ui-store.d.ts.map +0 -1
- package/dist/stores/viz-store.d.ts.map +0 -1
- package/dist/stores/worktree-store.d.ts.map +0 -1
- package/dist/types/brain.d.ts.map +0 -1
- package/dist/types/chronicle.d.ts.map +0 -1
- package/dist/types/client-message.d.ts.map +0 -1
- package/dist/types/collab.d.ts.map +0 -1
- package/dist/types/connections.d.ts.map +0 -1
- package/dist/types/goal-kanban-worktree.d.ts.map +0 -1
- package/dist/types/protocol-core.d.ts.map +0 -1
- package/dist/types/runtime.d.ts.map +0 -1
- package/dist/types/sage.d.ts.map +0 -1
- package/dist/types/server-message.d.ts.map +0 -1
- package/dist/types/skills-design.d.ts.map +0 -1
- package/dist/types/system.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fi as t,Gn as n,Ji as r,Li as i,Pt as a,Ri as o,Rt as s,Sa as c,Wt as l,Xr as u,br as d,dn as f,et as p,ga as m,gr as h,ia as g,on as _,or as v,si as y,t as b,wa as x,ya as S}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{t as ee}from"./useWebSocket-BVFPigcY.js";import{t as C}from"./ws-client-B0-KwuTK.js";import{t as w}from"./utils-CwJvjOcH.js";import{M as te}from"./stores-DyQOSkkD.js";import{o as T}from"./view-navigation-BMRzqGbq.js";import{n as E}from"./Toaster-BmyghnqJ.js";import{a as D,n as ne,o as re,r as O,t as k}from"./dialog-BJef9ZZo.js";import{t as A}from"./button-BMECp1cg.js";import{t as j}from"./input-Bd10nfMj.js";import{C as M,S as N,a as P,i as F,k as I,r as L,t as R}from"./index-x6-rLl5H.js";var z=e(x(),1);function B(e,t=8e3){return new Promise((n,r)=>{let i=setTimeout(()=>{a(),r(Error(`timeout`))},t),a=e.on(`key.operation_result`,e=>{clearTimeout(i),a(),n(e.payload)})})}var V=p();function ie({onKeySaved:e}){let{t:r}=S(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(`openai-compatible`),[u,d]=(0,z.useState)(``),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)([]),{setFieldRef:y,handleKeyDown:b}=P(),x=async()=>{if(o.trim()){g(!0);try{let t=C(te.getState().wsUrl),n=B(t);t.send({type:`provider.add`,payload:{id:o.trim(),family:c,baseUrl:u.trim()||void 0,apiKey:p.trim()||void 0,models:_.length>0?_.map(e=>e.id):void 0,customModels:_.length>0?Object.fromEntries(_.filter(e=>e.name||e.maxOutput||e.capabilities).map(e=>[e.id,{...e.name&&e.name!==e.id?{name:e.name}:{},...e.maxOutput?{maxOutput:e.maxOutput}:{},...e.capabilities&&Object.values(e.capabilities).some(Boolean)?{capabilities:e.capabilities}:{}}])):void 0}});let i=await n;if(!i.success)throw Error(i.message);E.success(r(`setup:screen.toasts.providerAdded`,{id:o.trim()})),e(o.trim()),t.listSavedProviders(),t.probeProvider(o.trim()),s(``),d(``),m(``),v([]),a(!1)}catch(e){let t=e instanceof Error&&e.message&&e.message!==`timeout`?e.message:null;E.error(t??r(`setup:screen.toasts.providerAddFailed`))}finally{g(!1)}}};return(0,V.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/60 overflow-hidden`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>a(!i),className:`w-full flex items-center gap-3 p-4 text-left hover:bg-muted/30 transition-colors`,children:[(0,V.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center`,children:(0,V.jsx)(f,{className:`h-5 w-5 text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium`,children:r(`setup:screen.custom.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`setup:screen.custom.description`)})]}),(0,V.jsx)(t,{className:w(`h-4 w-4 text-muted-foreground transition-transform`,i&&`rotate-90`)})]}),i&&(0,V.jsxs)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/40`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground block`,children:r(`setup:screen.custom.localServers`)}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:L.map(e=>(0,V.jsx)(A,{type:`button`,size:`sm`,variant:o===e.id?`default`:`outline`,onClick:()=>{s(e.id),l(`openai-compatible`),d(e.defaultBaseUrl),e.noAuth&&m(``),v([])},title:e.hint,children:e.label},e.id))})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:r(`setup:screen.custom.providerId`)}),(0,V.jsx)(j,{placeholder:`e.g. my-llm`,value:o,onChange:e=>s(e.target.value),className:`text-sm`,ref:y(0),onKeyDown:e=>b(e,0)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:r(`setup:screen.custom.family`)}),(0,V.jsxs)(`select`,{value:c,onChange:e=>l(e.target.value),className:`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm`,ref:y(1),onKeyDown:e=>b(e,1),children:[(0,V.jsx)(`option`,{value:`openai-compatible`,children:r(`setup:screen.custom.familyOpenAiCompatible`)}),(0,V.jsx)(`option`,{value:`openai`,children:`OpenAI`}),(0,V.jsx)(`option`,{value:`anthropic`,children:`Anthropic`}),(0,V.jsx)(`option`,{value:`google`,children:`Google`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:r(`setup:screen.custom.baseUrl`)}),(0,V.jsx)(j,{placeholder:`e.g. http://localhost:11434/v1`,value:u,onChange:e=>d(e.target.value),className:`text-sm font-mono`,ref:y(2),onKeyDown:e=>b(e,2)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground mb-1 block`,children:r(`setup:screen.custom.apiKey`)}),(0,V.jsx)(j,{type:`password`,placeholder:r(`setup:screen.custom.apiKeyPlaceholder`),value:p,onChange:e=>m(e.target.value),className:`text-sm font-mono`,ref:y(3),onKeyDown:e=>b(e,3)})]}),(0,V.jsx)(R,{models:_,onChange:v}),(0,V.jsxs)(A,{onClick:x,disabled:!o.trim()||h,size:`sm`,ref:y(4),onKeyDown:e=>b(e,4,x),children:[h?(0,V.jsx)(n,{className:`h-4 w-4 animate-spin mr-2`}):null,r(`setup:screen.custom.add`)]})]})]})}var H=F();async function ae(e,t){try{let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.json();if(!Array.isArray(r))throw Error(`Expected JSON array`);let i=r.filter(e=>typeof e.id==`string`&&typeof e.name==`string`&&typeof e.family==`string`);return i.length>0?i:H}catch{return H}}function oe(e,t){let n=new Date().getTime()-e.getTime(),r=Math.floor(n/1e3);if(r<10)return t(`setup:screen.time.justNow`);if(r<60)return t(`setup:screen.time.secondsAgo`,{count:r});let i=Math.floor(r/60);if(i<60)return t(`setup:screen.time.minutesAgo`,{count:i});let a=Math.floor(i/60);return a<24?t(`setup:screen.time.hoursAgo`,{count:a}):t(`setup:screen.time.daysAgo`,{count:Math.floor(a/24)})}var se=e(b(),1);function ce({popular:e,catalogProvider:r,savedProvider:a,onKeySaved:s,probeResult:c}){let{t:f}=S(),[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(!1),[_,v]=(0,z.useState)(!!a?.apiKeys.some(e=>e.isActive)),[b,x]=(0,z.useState)(!1),[ee,T]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!1),[P,F]=(0,z.useState)(null);(0,z.useEffect)(()=>{M&&e.referral&&se.toDataURL(e.referral.url,{width:200,margin:2,color:{dark:`#000000`,light:`#ffffff`}}).then(e=>F(e)).catch(()=>F(null))},[M,e.referral]);let I=async()=>{if(p.trim()){g(!0);try{let t=C(te.getState().wsUrl),n=B(t);r?t.addKey(e.id,`default`,p.trim()):t.send({type:`provider.add`,payload:{id:e.id,family:e.family,apiKey:p.trim()}});let i=await n;if(!i.success)throw Error(i.message);v(!0),m(``),E.success(f(`setup:screen.toasts.keySaved`,{name:e.name})),s(e.id),t.listSavedProviders(),t.probeProvider(e.id)}catch(t){let n=t instanceof Error&&t.message&&t.message!==`timeout`?t.message:null;E.error(n??f(`setup:screen.toasts.keySaveFailed`,{name:e.name}))}finally{g(!1)}}},L=e=>{e.key===`Enter`&&p.trim()&&I()},R=async()=>{if(e.referral)try{await navigator.clipboard.writeText(e.referral.url),T(!0),E.success(f(`setup:screen.toasts.referralCopied`)),setTimeout(()=>T(!1),2e3)}catch{E.error(f(`setup:screen.toasts.referralCopyFailed`))}},ie=r&&r.modelCount>0;return(0,V.jsxs)(`div`,{className:w(`rounded-xl border p-4 transition-all`,_?`border-success/30 bg-success/5`:`bg-gradient-to-br ${e.color}`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`text-2xl shrink-0 mt-0.5`,children:e.icon}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),_&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-success/10 text-success border border-success/20`,children:[(0,V.jsx)(o,{className:`h-2.5 w-2.5`}),f(`setup:screen.card.keySaved`)]}),e.referral&&!_&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-warning/10 text-warning border border-warning/20`,children:[(0,V.jsx)(d,{className:`h-2.5 w-2.5`}),f(`setup:screen.card.referral`)]})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),e.referral&&!_&&(0,V.jsxs)(`p`,{className:`text-[11px] text-warning/80 mt-1`,children:[`🎁 `,e.referral.reward]}),_?_?(0,V.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[a?.baseUrl&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70 font-mono truncate`,title:a.baseUrl,children:[(0,V.jsx)(`span`,{className:`text-muted-foreground/50`,children:`URL: `}),a.baseUrl]}),a?.models&&a.models.length>0&&(0,V.jsxs)(`div`,{className:`text-[11px] text-muted-foreground/70`,children:[(0,V.jsx)(`span`,{className:`text-muted-foreground/50`,children:`Models: `}),a.pickedModelId??a.models[0],(0,V.jsxs)(`span`,{className:`text-muted-foreground/50`,children:[` (+`,a.models.length-1,` more)`]})]}),c===`probing`?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-muted-foreground mt-1`,children:[(0,V.jsx)(n,{className:`h-3 w-3 animate-spin`}),f(`setup:screen.probe.checking`,`Checking connection…`)]}):c?.ok?(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-success mt-1`,children:[(0,V.jsx)(o,{className:`h-3 w-3`}),(0,V.jsxs)(`span`,{children:[f(`setup:screen.probe.connected`,`Connected`),c.modelCount!=null&&` · ${c.modelCount} ${f(`setup:screen.probe.models`,`models`)}`,c.elapsedMs!=null&&` · ${c.elapsedMs}ms`]})]}):c&&!c.ok?(0,V.jsxs)(`div`,{className:`flex items-start gap-1.5 text-[11px] text-destructive mt-1`,children:[(0,V.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:`✕`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:f(`setup:screen.probe.failed`,`Probe failed`)}),c.status===`no_base_url`&&(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:f(`setup:screen.probe.noBaseUrl`,`No base URL configured`)}),c.status===`unreachable`&&(0,V.jsxs)(`span`,{className:`block text-destructive/70`,children:[f(`setup:screen.probe.unreachable`,`Could not connect`),c.detail?`: ${c.detail}`:``]}),c.status!==`no_base_url`&&c.status!==`unreachable`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`block text-destructive/70`,children:c.httpStatus==null?c.status:`${f(`setup:screen.probe.httpStatus`,`Status`)} ${c.httpStatus}`}),c.detail&&(0,V.jsx)(`span`,{className:`block text-destructive/70 truncate max-w-[250px]`,title:c.detail,children:c.detail})]})]})]}):null,ie&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>x(!b),className:`text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1`,children:[f(`setup:screen.providers.modelsAvailable`,{count:r?.modelCount??0}),b?(0,V.jsx)(i,{className:`h-3 w-3`}):(0,V.jsx)(t,{className:`h-3 w-3`})]})]}):null:(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(j,{type:`password`,placeholder:e.keyPlaceholder,value:p,onChange:e=>m(e.target.value),onKeyDown:L,className:`font-mono text-sm`}),(0,V.jsx)(A,{onClick:I,disabled:!p.trim()||h,size:`sm`,className:`shrink-0`,children:h?(0,V.jsx)(n,{className:`h-4 w-4 animate-spin`}):f(`setup:screen.card.save`)})]}),e.docsUrl&&(0,V.jsxs)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors`,children:[f(`setup:screen.card.getKey`),` `,(0,V.jsx)(u,{className:`h-3 w-3`})]}),e.referral&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:R,className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:ee?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(o,{className:`h-3 w-3`}),` `,f(`setup:screen.card.copied`)]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(y,{className:`h-3 w-3`}),` `,f(`setup:screen.card.copyReferral`)]})}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),className:`inline-flex items-center gap-1 text-[11px] text-warning/80 hover:text-warning transition-colors`,children:[(0,V.jsx)(l,{className:`h-3 w-3`}),` `,f(`setup:screen.card.share`)]})]})]})]})]}),(0,V.jsx)(k,{open:M,onOpenChange:N,children:(0,V.jsxs)(ne,{className:`sm:max-w-md`,children:[(0,V.jsxs)(D,{children:[(0,V.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,V.jsx)(d,{className:`h-4 w-4 text-warning`}),f(`setup:screen.share.title`,{name:e.name})]}),(0,V.jsx)(O,{children:f(`setup:screen.share.description`)})]}),(0,V.jsx)(`div`,{className:`flex flex-col items-center gap-4 py-4`,children:e.referral&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`text-sm text-center`,children:(0,V.jsxs)(`p`,{className:`font-medium text-warning`,children:[`🎁 `,e.referral.reward]})}),P?(0,V.jsx)(`div`,{className:`rounded-lg border border-border p-2 bg-white`,children:(0,V.jsx)(`img`,{src:P,alt:f(`setup:screen.card.qrAlt`,{name:e.name}),className:`w-[200px] h-[200px]`})}):(0,V.jsx)(`div`,{className:`w-[200px] h-[200px] rounded-lg border border-border flex items-center justify-center bg-muted`,children:(0,V.jsx)(n,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),(0,V.jsxs)(`div`,{className:`w-full space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://twitter.com/intent/tweet?text=${t}&url=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.twitter`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z`})}),`X`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`Check out ${e.name}! ${e.referral.reward}`);window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${t}&summary=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.linkedin`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`})}),`LinkedIn`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward} ${e.referral.url}`);window.open(`https://t.me/share/url?url=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.telegram`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`})}),`Telegram`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://wa.me/?text=${t}%20${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.whatsapp`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.134 1.585 5.934L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z`})}),`WhatsApp`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(e.referral.url),n=encodeURIComponent(`${e.name} - ${e.referral.reward}`);window.open(`https://www.reddit.com/submit?url=${t}&title=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.reddit`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 0 1.108-.701 1.25 1.25 0 0 1 2.144.33zm-8.811 8.748c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754zm7.944 0c-.968 0-1.754.786-1.754 1.754 0 .968.786 1.754 1.754 1.754.968 0 1.754-.786 1.754-1.754 0-.968-.786-1.754-1.754-1.754z`})}),`Reddit`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`https://www.facebook.com/sharer/sharer.php?u=${n}"e=${t}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg border border-border bg-card text-xs text-foreground hover:bg-muted transition-colors`,title:f(`setup:screen.share.facebook`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{d:`M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z`})}),`Facebook`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{let t=encodeURIComponent(`Check out ${e.name}! 🎁 ${e.referral.reward}`),n=encodeURIComponent(e.referral.url);window.open(`mailto:?subject=${t}&body=${n}`,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-muted text-muted-foreground text-xs hover:bg-muted/80 transition-colors`,title:f(`setup:screen.share.email`),children:[(0,V.jsx)(`svg`,{role:`img`,"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:(0,V.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25H4.5a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75`})}),`Email`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(j,{value:e.referral.url,readOnly:!0,className:`font-mono text-xs flex-1`}),(0,V.jsx)(A,{size:`sm`,variant:`outline`,onClick:R,className:`shrink-0`,children:ee?(0,V.jsx)(o,{className:`h-4 w-4`}):(0,V.jsx)(y,{className:`h-4 w-4`})})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground text-center`,children:f(`setup:screen.share.hint`)})]})]})})]})})]})}function U(){let{t:e}=S(),{model:i,setProvider:l,setModel:u,wsConnected:d,wsUrl:f}=te(m(e=>({model:e.model,setProvider:e.setProvider,setModel:e.setModel,wsConnected:e.wsConnected,wsUrl:e.wsUrl})));ee();let[p,y]=(0,z.useState)([]),[b,x]=(0,z.useState)({}),[D,ne]=(0,z.useState)([]),[re,O]=(0,z.useState)(!1),[k,j]=(0,z.useState)(null),[P,F]=(0,z.useState)(0),[L,R]=(0,z.useState)(new Set),[B,se]=(0,z.useState)({}),[U,le]=(0,z.useState)(H),[W,G]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(0),[fe,pe]=(0,z.useState)(0),[K,me]=(0,z.useState)(null),q=(0,z.useRef)(!0);(0,z.useEffect)(()=>{let e=new AbortController,t=`${window.location.origin}/providers.json`;return G(!0),ae(t,e.signal).then(t=>{if(t!==H){if(le(t),G(!1),!q.current){let e=t.length-fe;e>0?E.success(c.t(`setup:screen.toasts.providersLoadedNew`,{count:t.length,diff:e})):e<0?E.success(c.t(`setup:screen.toasts.providersLoadedRemoved`,{count:t.length,diff:Math.abs(e)})):E.success(c.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:t.length})),pe(t.length)}me(new Date);return}return ae(`https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/webui/public/providers.json`,e.signal)}).then(e=>{if(e){if(le(e),!q.current){let t=e.length-fe;t>0?E.success(c.t(`setup:screen.toasts.providersLoadedNew`,{count:e.length,diff:t})):t<0?E.success(c.t(`setup:screen.toasts.providersLoadedRemoved`,{count:e.length,diff:Math.abs(t)})):E.success(c.t(`setup:screen.toasts.providersLoadedNoChanges`,{count:e.length})),pe(e.length)}me(new Date)}}).catch(()=>{q.current||E.error(c.t(`setup:screen.toasts.providersRefreshFailed`))}).finally(()=>{G(!1),q.current=!1}),()=>e.abort()},[ue]);let[J,he]=(0,z.useState)(null),[Y,X]=(0,z.useState)(null),[ge,_e]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!d)return;let e=C(f),t=setTimeout(()=>{t=null,O(!1),j(c.t(`setup:screen.errors.backendNotResponding`))},8e3),n=()=>{t&&=(clearTimeout(t),null)},r=e.on(`provider.catalog`,e=>{if(e.type===`provider.catalog`){n(),j(null);let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));y(t),O(!1)}}),a=e.on(`provider.models`,e=>{if(e.type===`provider.models`){let t=e.payload;if(t.provider!==J)return;x(e=>({...e,[t.provider]:t.models})),_e(!1),t.models.length===1?X(t.models[0].id):i&&t.models.some(e=>e.id===i)&&X(i)}}),o=e.on(`providers.saved`,e=>{if(e.type===`providers.saved`){let t=e.payload.providers.sort((e,t)=>e.id.localeCompare(t.id));ne(t);let n=new Set(t.filter(e=>e.apiKeys.some(e=>e.isActive)).map(e=>e.id));R(n)}}),s=e.on(`provider.probe`,e=>{if(e.type!==`provider.probe`)return;let t=e.payload;se(e=>({...e,[t.providerId]:t}))});return j(null),O(!0),e.listProviders(),()=>{n(),r?.(),a?.(),o?.(),s?.()}},[d,f,i,P]);let ve=(0,z.useCallback)(()=>{j(null),F(e=>e+1)},[]),ye=(0,z.useCallback)(()=>{de(e=>e+1)},[]),be=(0,z.useCallback)(t=>oe(t,e),[e]),Z=(0,z.useCallback)(e=>{R(t=>new Set([...t,e])),he(e),X(null)},[]),xe=L.size>0;(0,z.useEffect)(()=>{if(!J||!d)return;let e=C(f);b[J]||(_e(!0),e.listProviderModels(J))},[J,d,f,b]);let Se=J?b[J]??[]:[],Ce=(0,z.useCallback)(async()=>{if(!J||!Y)return;if(!L.has(J)){E.error(`Please save the provider configuration before starting a session.`);return}l(J),u(Y);let e=C(f),t=await e.switchModel(J,Y,5e3);t.success?(e.newSession(),T(`chat`)):E.error(t.message||c.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,l,u,f]),we=(0,z.useCallback)(async()=>{if(!J||!Y)return;l(J),u(Y);let e=await C(f).switchModel(J,Y,5e3);e.success?T(`chat`):E.error(e.message||c.t(`setup:screen.errors.modelSwitchTimeout`))},[J,Y,l,u,f]),Te=new Set(U.map(e=>e.id)),Ee=p.filter(e=>!Te.has(e.id)).sort((e,t)=>e.id.localeCompare(t.id)),Q=M(Ee,10);M(D,9);let $=M(Se,12,J);return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,V.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b bg-card px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(`img`,{src:`/wrongstack.svg`,alt:`WrongStack`,draggable:!1,className:`ws-brand-logo h-10 w-10 shrink-0 border border-border/70 shadow-sm`}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:e(`setup:screen.header.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground sm:truncate`,children:e(`setup:screen.header.subtitle`)})]})]}),xe&&J?(0,V.jsxs)(`span`,{className:`text-xs text-success/80`,children:[(0,V.jsx)(o,{className:`h-3 w-3 inline-block mr-1`}),e(`setup:screen.header.continue`)]}):null]}),(0,V.jsx)(I,{className:`min-h-0 flex-1`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-4 pb-4 sm:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,xe?`text-success`:`text-primary font-medium`),children:[(0,V.jsx)(v,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.addKeys`)})]}),(0,V.jsx)(t,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(r,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.pickModel`)})]}),(0,V.jsx)(t,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,V.jsxs)(`div`,{className:w(`flex min-w-0 items-center gap-1.5`,J&&Y?`text-primary font-medium`:`text-muted-foreground`),children:[(0,V.jsx)(a,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:e(`setup:screen.steps.start`)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-primary/20 bg-primary/5 p-4`,children:[(0,V.jsx)(s,{className:`h-5 w-5 text-primary shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium`,children:e(`setup:screen.security.title`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`setup:screen.security.body`)})]})]}),k?(0,V.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-4 py-12 rounded-xl border border-destructive/30 bg-destructive/5 px-6`,children:[(0,V.jsx)(`div`,{className:`w-12 h-12 rounded-xl bg-destructive/10 border border-destructive/30 flex items-center justify-center`,children:(0,V.jsx)(h,{className:`h-6 w-6 text-destructive`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-destructive`,children:e(`setup:screen.errors.backendUnreachable`)}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 max-w-sm`,children:k})]}),(0,V.jsxs)(A,{onClick:ve,size:`sm`,variant:`outline`,children:[(0,V.jsx)(n,{className:`h-4 w-4 mr-2`}),e(`setup:screen.errors.retry`)]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.popular`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[W&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground`,children:[(0,V.jsx)(n,{className:`h-3 w-3 animate-spin`}),e(`setup:screen.providers.updating`)]}),K&&!W&&(0,V.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,title:K.toLocaleString(),children:be(K)}),(0,V.jsxs)(`button`,{type:`button`,onClick:ye,disabled:W,className:`inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,title:e(`setup:screen.providers.refreshTitle`),children:[(0,V.jsx)(_,{className:w(`h-3 w-3`,W&&`animate-spin`)}),e(`setup:screen.providers.refresh`)]})]})]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:U.map(e=>(0,V.jsx)(ce,{popular:e,catalogProvider:p.find(t=>t.id===e.id),savedProvider:D.find(t=>t.id===e.id),onKeySaved:Z,probeResult:B[e.id]},e.id))})]}),Ee.length>0&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.more`)}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:Q.pageItems.map(t=>(0,V.jsx)(ce,{popular:{id:t.id,name:t.name,description:e(`setup:screen.providers.catalogDescription`,{family:t.family,count:t.modelCount}),icon:`🔗`,color:`from-muted/60 to-muted/20 border-border hover:border-primary/40`,keyPlaceholder:`API key`,family:t.family},catalogProvider:t,savedProvider:D.find(e=>e.id===t.id),onKeySaved:Z,probeResult:B[t.id]},t.id))}),(0,V.jsx)(N,{page:Q.page,pageSize:Q.pageSize,totalItems:Q.totalItems,onPageChange:Q.setPage,itemLabel:`providers`})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-muted-foreground uppercase tracking-wider`,children:e(`setup:screen.providers.selfHosted`)}),(0,V.jsx)(ie,{onKeySaved:Z})]})]}),re&&(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(n,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),J&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h2`,{className:`text-base font-semibold flex items-center gap-2`,children:[(0,V.jsx)(a,{className:`h-4 w-4 text-primary`}),e(`setup:screen.start.chooseModel`)]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{he(null),X(null)},className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:e(`setup:screen.start.addMoreKeys`)})]}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`setup:screen.start.modelsFor`,{provider:J})}),ge?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,V.jsx)(n,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):Se.length>0?(0,V.jsx)(`div`,{className:`grid grid-cols-1 gap-2`,children:$.pageItems.map(e=>{let t=e.contextWindow?`${(e.contextWindow/1e6).toFixed(0)}M ctx`:null;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>X(e.id),className:w(`w-full text-left rounded-xl border p-3 transition-all`,`hover:border-primary/40 hover:bg-primary/5`,Y===e.id?`border-primary bg-primary/10 ring-1 ring-primary/30`:`border-border bg-card`),children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mt-1`,children:[t&&(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:t}),e.capabilities.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-primary/10 text-primary border border-primary/20`,children:e},e))]})]}),Y===e.id&&(0,V.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary`,children:(0,V.jsx)(o,{className:`h-3 w-3 text-primary-foreground`})})]})},e.id)})}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground py-8 text-center`,children:e(`setup:screen.errors.noModels`)}),(0,V.jsx)(N,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,itemLabel:`models`})]}),J&&Y&&(0,V.jsxs)(`div`,{className:`sticky bottom-0 -mx-4 border-t bg-background/80 px-4 py-4 backdrop-blur-sm sm:-mx-6 sm:px-6`,children:[(0,V.jsx)(`div`,{className:`mb-3 flex min-w-0 items-center justify-between gap-2 text-sm text-muted-foreground`,children:(0,V.jsxs)(`span`,{className:`min-w-0 truncate`,children:[J,` / `,Y]})}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-2`,children:[(0,V.jsxs)(A,{onClick:Ce,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(r,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.startSession`),(0,V.jsx)(g,{className:`h-4 w-4 ml-2`})]}),(0,V.jsxs)(A,{onClick:we,variant:`outline`,className:`flex-1`,size:`lg`,children:[(0,V.jsx)(o,{className:`h-4 w-4 mr-2`}),e(`setup:screen.start.saveConfig`)]})]}),(0,V.jsx)(`p`,{className:`text-[11px] text-muted-foreground/60 text-center mt-2`,children:e(`setup:screen.start.saveConfigHint`)})]})]})})]})}export{U as SetupScreen};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-BTTkQ9Tn.js","assets/rolldown-runtime-QTnfLwEv.js","assets/monaco-BLUV5g0U.js","assets/monaco-Bowa0-zp.css","assets/markdown-sSmz-Ua_.js","assets/vendor-BMdWcCR4.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fi as t,Fr as n,Gn as r,Ii as ee,Pt as te,Ri as ne,Sa as i,Xi as re,et as a,gr as ie,hn as ae,kr as oe,nt as o,on as se,si as ce,ta as s,ti as le,wa as c,xt as l,ya as u,yn as ue}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{n as de}from"./ui-store-di6oY7cy.js";import{s as d}from"./monaco-BLUV5g0U.js";import{t as fe}from"./useWebSocket-BVFPigcY.js";import{t as f}from"./utils-CwJvjOcH.js";import{o as pe}from"./view-navigation-BMRzqGbq.js";import{a as me,n as he,o as ge,t as _e}from"./dialog-BJef9ZZo.js";import{p}from"./markdown-sSmz-Ua_.js";import{c as ve,g as m,u as h}from"./index-x6-rLl5H.js";import{t as ye}from"./empty-state-BGzRrNXI.js";var g=e(c(),1),_=a(),be=(0,g.lazy)(()=>d(()=>import(`./vendor-BTTkQ9Tn.js`).then(e=>e.S),__vite__mapDeps([0,1,2,3,4,5])));function v(e){return e===`project`||e===`user`}function xe(e){let t=e.match(/^(.+?)\/SKILL(?:\.save)?\.md$/);return t?t[1]:null}function Se({source:e}){let{t}=u(),n=e===`project`?`project`:e===`user`?`user`:`bundled`;return(0,_.jsx)(`span`,{className:f(`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide`,n===`project`&&`border-success/25 bg-success/8 text-success`,n===`user`&&`border-primary/25 bg-primary/10 text-primary`,n===`bundled`&&`border-border/70 bg-muted/60 text-muted-foreground`),children:t(`activity:skillDetail.${{project:`scopeProject`,user:`scopeGlobal`,bundled:`scopeBundled`}[n]}`)})}function y({className:e}){let{t:a}=u(),{client:c}=fe(),d=de(e=>e.skillsState),y=de(e=>e.setSkillsState),b=d.selectedSkill,x=d.navHistory,S=d.historyIndex,[C,w]=(0,g.useState)(null),[Ce,T]=(0,g.useState)(!1),[E,D]=(0,g.useState)(null),we=ve(`skill-detail`,!!C),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(null),[Te,B]=(0,g.useState)(!1),V=(0,g.useRef)(``),[Ee,De]=(0,g.useState)(!1),[H,U]=(0,g.useState)(null),[Oe,ke]=(0,g.useState)(!1),[W,G]=(0,g.useState)(null),[K,Ae]=(0,g.useState)(!1),[je,Me]=(0,g.useState)([]),q=(0,g.useRef)(d);q.current=d;let J=(0,g.useRef)(!1),Y=(0,g.useMemo)(()=>A?{lines:A.split(`
|
|
3
|
+
`).length,words:A.trim()?A.trim().split(/\s+/).length:0,chars:A.length}:{lines:0,words:0,chars:0},[A]),X=(0,g.useMemo)(()=>{if(!A)return null;let e=5*1024*1024,t=new Blob([A]).size;return t>=e?{level:`critical`,used:t,limit:e}:t>=4194304?{level:`warn`,used:t,limit:e}:null},[A]);(0,g.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>z(null),2e3);return()=>clearTimeout(e)},[R]),(0,g.useEffect)(()=>{if(!O||!b)return;let e=setInterval(()=>{A&&A!==V.current&&(V.current=A,localStorage.setItem(`skills_draft_${b.name}`,JSON.stringify({content:A,savedAt:Date.now()})),z(Date.now()))},5e3);return()=>clearInterval(e)},[O,A,b]),(0,g.useEffect)(()=>{if(!b||!O)return;let e=localStorage.getItem(`skills_draft_${b.name}`);if(e)try{let{content:t}=JSON.parse(e);t&&t!==A&&t!==V.current&&(j(t),V.current=t,B(!0))}catch{}},[b?.name,O]),(0,g.useEffect)(()=>{if(!c||!b)return;T(!0),w(null),D(null);let e=setTimeout(()=>{T(!1),D(i.t(`activity:skillDetail.timeoutError`))},1e4),t=t=>{clearTimeout(e);let n=t;n.payload.error?D(n.payload.error):n.payload.name&&w(n.payload),T(!1)},n=e=>{let t=e;De(!1);let n=q.current;if(t.payload.success){let e={...n.knownRefs};for(let n of t.payload.updated??[])e[n.name]=n.newRef;y({...n,knownRefs:e,updateAvailableCount:0}),U({updated:t.payload.updated??[],unchanged:t.payload.unchanged??[],errors:t.payload.errors??[]}),c.send({type:`skills.list`},{echoToChat:!1})}else U({updated:[],unchanged:[],errors:[{name:``,error:t.payload.error??i.t(`activity:skillDetail.updateFailed`)}]})},r=e=>{let t=e;t.payload.skills&&Me(t.payload.skills)};return c.on(`skills.content`,t),c.on(`skills.updated`,n),c.on(`skills.list`,r),c.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),()=>{clearTimeout(e),c.off(`skills.content`,t),c.off(`skills.updated`,n),c.off(`skills.list`,r)}},[c,b?.name,b?.source]),(0,g.useEffect)(()=>{O&&(k(!1),j(``),F(null))},[b?.name]);let Z=(0,g.useCallback)(e=>je.find(t=>t.name.toLowerCase()===e.toLowerCase()),[je]),Q=(0,g.useCallback)(e=>{let t=Z(e);if(t){J.current=!1;let e=x.slice(0,S+1);e.push(t),y({...q.current,selectedSkill:t,navHistory:e,historyIndex:e.length-1}),k(!1),j(``),U(null)}},[Z,x,S,y]),Ne=(0,g.useCallback)(()=>{if(S<=0)return;J.current=!0;let e=S-1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),Pe=(0,g.useCallback)(()=>{if(S>=x.length-1)return;J.current=!0;let e=S+1,t=x[e];y({...q.current,selectedSkill:t,historyIndex:e}),k(!1),j(``),U(null)},[S,x,y]),$=(0,g.useCallback)(()=>{pe(`chat`)},[]),Fe=(0,g.useCallback)(()=>{C&&(j(C.body),V.current=C.body,B(!1),F(null),k(!0),L(!1))},[C]),Ie=(0,g.useCallback)(()=>{k(!1),j(``),F(null),L(!1),B(!1),b&&localStorage.removeItem(`skills_draft_${b.name}`)},[b]),Le=(0,g.useCallback)(()=>{!b||!C||(B(!1),j(C.body),V.current=C.body,b&&localStorage.removeItem(`skills_draft_${b.name}`))},[b,C]),Re=(0,g.useCallback)(()=>{if(!c||!b||!A.trim())return;N(!0),F(null);let e=t=>{let n=t;N(!1),n.payload.success?(V.current=``,localStorage.removeItem(`skills_draft_${b.name}`),B(!1),k(!1),c.send({type:`skills.content`,payload:{name:b.name,source:b.source}}),c.send({type:`skills.list`},{echoToChat:!1})):F(n.payload.error??i.t(`activity:skillDetail.saveFailed`)),c.off(`skills.edited`,e)};c.on(`skills.edited`,e),c.editSkill(b.name,A)},[c,b,A]),ze=(0,g.useCallback)(()=>{!c||!b||(De(!0),U(null),c.checkForUpdates(b.name,b.source===`user`))},[c,b]),Be=(0,g.useCallback)(()=>{b?.sourceUrl&&navigator.clipboard.writeText(b.sourceUrl).then(()=>{ke(!0),setTimeout(()=>ke(!1),2e3)})},[b]),Ve=(0,g.useCallback)(()=>{if(!C?.body)return;let e=new Blob([C.body],{type:`text/markdown`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${C.name.replace(/\//g,`_`)}-SKILL.md`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},[C]),He=(0,g.useCallback)(async e=>{if(!c||!e)return;Ae(!0);let t=e=>{let n=e;Ae(!1),n.payload.success?(G(null),c.send({type:`skills.list`},{echoToChat:!1}),$()):F(n.payload.error??i.t(`activity:skillDetail.uninstallFailed`)),c.off(`skills.uninstalled`,t)};c.on(`skills.uninstalled`,t),c.uninstallSkill(e.name,e.source===`user`)},[c,$]);return b?(0,_.jsxs)(`div`,{className:f(`flex h-full min-h-0 min-w-0 flex-col gap-3 overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:[(0,_.jsxs)(`div`,{className:`shrink-0 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,_.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,_.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,_.jsx)(te,{className:`h-4 w-4`})}),(0,_.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold`,children:b.name}),b.version&&(0,_.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`v`,b.version]}),(0,_.jsx)(Se,{source:b.source})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:b.description||b.trigger}),b.sourceUrl&&(0,_.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1`,children:[(0,_.jsxs)(`a`,{href:`https://${b.sourceUrl.replace(`github:`,``)}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,title:a(`activity:skillDetail.openSourceRepo`),children:[(0,_.jsx)(ie,{className:`h-3 w-3 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate font-mono`,children:b.sourceUrl})]}),(0,_.jsx)(`button`,{type:`button`,onClick:Be,className:`flex shrink-0 items-center text-muted-foreground transition-colors hover:text-foreground`,title:a(`activity:skillDetail.copySourceUrl`),children:Oe?(0,_.jsx)(ne,{className:`h-3 w-3 text-success`}):(0,_.jsx)(ce,{className:`h-3 w-3`})})]}),b.scope.length>0&&(0,_.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:b.scope.map(e=>(0,_.jsx)(`span`,{className:`px-1.5 py-0.5 text-[10px] rounded bg-muted text-muted-foreground`,children:e},e))}),H&&(0,_.jsxs)(`div`,{className:`mt-2 text-xs space-y-1`,children:[H.updated.length>0&&(0,_.jsx)(`div`,{className:`text-success`,children:a(`activity:skillDetail.updatedLabel`,{list:H.updated.map(e=>`${e.name} (${e.oldRef} → ${e.newRef})`).join(`, `)})}),H.unchanged.length>0&&(0,_.jsx)(`div`,{className:`text-muted-foreground`,children:a(`activity:skillDetail.upToDateLabel`,{list:H.unchanged.join(`, `)})}),H.errors.length>0&&(0,_.jsx)(`div`,{className:`text-destructive`,children:a(`activity:skillDetail.errorsLabel`,{list:H.errors.map(e=>`${e.name?`${e.name}: `:``}${e.error}`).join(`; `)})})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 lg:ml-auto lg:shrink-0 lg:justify-end`,children:[v(b.source)&&b.sourceUrl&&(0,_.jsx)(`button`,{type:`button`,onClick:ze,disabled:Ee,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50`,title:a(`activity:skillDetail.checkUpdatesTitle`),children:Ee?(0,_.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(se,{className:`h-3.5 w-3.5`})}),b.source!==`bundled`&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Ve,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:a(`activity:skillDetail.exportTitle`),children:(0,_.jsx)(le,{className:`h-3.5 w-3.5`})}),v(b.source)&&!O&&(0,_.jsx)(`button`,{type:`button`,onClick:Fe,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:a(`activity:skillDetail.editTitle`),children:(0,_.jsx)(ae,{className:`h-3.5 w-3.5`})}),v(b.source)&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(b),className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,title:a(`activity:skillDetail.uninstallTitle`),children:(0,_.jsx)(l,{className:`h-3.5 w-3.5`})}),(0,_.jsx)(`button`,{type:`button`,onClick:$,className:`flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,title:a(`activity:skillDetail.closeTitle`),children:(0,_.jsx)(o,{className:`h-4 w-4`})})]})]}),x.length>1&&(0,_.jsxs)(`div`,{className:`mt-3 flex min-w-0 items-center gap-1 rounded-lg border border-border/60 bg-muted/35 px-2 py-1`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:Ne,disabled:S<=0,className:f(`rounded p-1 transition-colors`,S<=0?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:a(`activity:skillDetail.backTitle`),children:(0,_.jsx)(ee,{className:`h-4 w-4`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Pe,disabled:S>=x.length-1,className:f(`rounded p-1 transition-colors`,S>=x.length-1?`text-muted-foreground/65 cursor-not-allowed`:`hover:bg-accent text-muted-foreground cursor-pointer`),title:a(`activity:skillDetail.forwardTitle`),children:(0,_.jsx)(t,{className:`h-4 w-4`})}),(0,_.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto text-xs`,children:x.map((e,n)=>(0,_.jsxs)(`span`,{className:`flex items-center shrink-0`,children:[n>0&&(0,_.jsx)(t,{className:`h-3 w-3 text-muted-foreground/65 mx-0.5 shrink-0`}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{n<S&&(J.current=!0,y({...q.current,selectedSkill:e,historyIndex:n}),k(!1),j(``),U(null))},className:f(`hover:text-primary cursor-pointer transition-colors`,n===S?`text-primary font-medium`:`text-muted-foreground`),children:e.name})]},e.name+n))})]})]}),C&&(C.relatedFiles.length>0||C.references.length>0)&&(0,_.jsxs)(`div`,{className:`shrink-0 space-y-2 rounded-xl border border-border/70 bg-card/70 px-4 py-3 shadow-sm`,children:[C.relatedFiles.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(oe,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:a(`activity:skillDetail.relatedFiles`)})]}),C.relatedFiles.map(e=>{let t=xe(e);return t&&Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] transition-colors hover:border-primary/40 hover:text-primary`,title:a(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(s,{className:`h-2.5 w-2.5`}),e]},e):(0,_.jsx)(`span`,{className:`rounded-md border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:e},e)})]}),C.references.length>0&&(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,_.jsx)(n,{className:`h-3 w-3`}),(0,_.jsx)(`span`,{className:`font-medium uppercase tracking-wide`,children:a(`activity:skillDetail.references`)})]}),C.references.map(e=>{let t=xe(e)??e.replace(/\.md$/,``);return Z(t)?(0,_.jsxs)(`button`,{type:`button`,onClick:()=>Q(t),className:`inline-flex min-w-0 items-center gap-1 rounded-md border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-[10px] text-primary transition-colors hover:border-primary/30 hover:bg-primary/10`,title:a(`activity:skillDetail.goToSkillTitle`,{name:t}),children:[(0,_.jsx)(s,{className:`h-2.5 w-2.5`}),t]},e):(0,_.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground`,children:t},e)})]})]}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden rounded-xl border border-border/70 bg-card/70 shadow-sm`,children:Ce?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center text-muted-foreground`,children:[(0,_.jsx)(r,{className:`mx-auto mb-2 h-6 w-6 animate-spin text-primary`}),(0,_.jsx)(`p`,{children:a(`activity:skillDetail.loadingContent`)})]}):O?(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border/70 bg-muted/30 px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`activity:skillDetail.editingLabel`,{name:b.name})}),(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:a(`activity:skillDetail.editStats`,{lines:Y.lines,words:Y.words,chars:Y.chars})}),X&&(0,_.jsx)(`span`,{className:`text-xs tabular-nums ${X.level===`critical`?`font-medium text-destructive`:`text-warning`}`,children:a(`activity:skillDetail.charsWarningFmt`,{used:(X.used/(1024*1024)).toFixed(1),limit:(X.limit/(1024*1024)).toFixed(0)})}),R&&(0,_.jsx)(`span`,{className:`text-xs text-success animate-pulse`,children:a(`activity:skillDetail.draftSaved`)}),Te&&(0,_.jsx)(`span`,{className:`animate-pulse text-xs text-warning`,children:a(`activity:skillDetail.draftRestored`)})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[P&&(0,_.jsx)(`span`,{className:`text-xs text-destructive`,children:P}),Te&&(0,_.jsx)(`button`,{type:`button`,onClick:Le,className:`rounded-md border border-warning/35 px-2 py-1 text-[10px] text-warning transition-colors hover:bg-warning/10`,children:a(`activity:skillDetail.discardDraft`)}),(0,_.jsx)(`button`,{type:`button`,onClick:Ie,className:`rounded-md border border-border/70 px-2 py-1 text-xs transition-colors hover:bg-accent`,children:a(`common:action.cancel`)}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>L(e=>!e),title:a(I?`activity:skillDetail.hidePreviewTitle`:`activity:skillDetail.splitViewTitle`),className:`rounded-md border px-2 py-1 text-xs transition-colors ${I?`border-primary/40 bg-primary/10 text-primary`:`border-border/70 text-muted-foreground hover:bg-accent`}`,children:(0,_.jsx)(ue,{className:`h-3 w-3 inline`})}),(0,_.jsx)(`button`,{type:`button`,onClick:Re,disabled:M||!A.trim(),className:`rounded-md bg-primary px-3 py-1 text-xs text-primary-foreground shadow-sm shadow-primary/15 transition-colors hover:bg-primary/90 disabled:opacity-50`,children:M?(0,_.jsx)(r,{className:`h-3 w-3 animate-spin inline`}):a(`common:action.save`)})]})]}),I?(0,_.jsxs)(`div`,{className:`flex flex-1 min-h-0 gap-0.5`,children:[(0,_.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-0`,children:(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:a(`activity:skillDetail.contentPlaceholder`)})})}),(0,_.jsx)(`div`,{className:`w-px bg-border flex-shrink-0`}),(0,_.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain bg-background/45 p-4 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:A})})]}):(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(be,{value:A,onChange:e=>j(e.target.value??``),language:`markdown`,className:`flex-1`,style:{fontSize:12,backgroundColor:`transparent`,minHeight:0},placeholder:a(`activity:skillDetail.contentPlaceholder`)})})]}):C?(0,_.jsx)(`div`,{ref:we,className:`h-full min-h-0 overflow-y-auto overscroll-contain p-5 sm:p-6 prose prose-sm dark:prose-invert max-w-none`,children:(0,_.jsx)(h,{rehypePlugins:[p],components:m,children:C.body})}):E?(0,_.jsxs)(`div`,{className:`flex h-full min-h-[16rem] flex-col items-center justify-center p-8 text-center`,children:[(0,_.jsx)(`p`,{className:`text-destructive mb-2`,children:a(`activity:skillDetail.loadFailed`)}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>{c&&b&&(T(!0),D(null),c.send({type:`skills.content`,payload:{name:b.name,source:b.source}}))},className:`mt-4 rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent`,children:a(`common:action.retry`)})]}):(0,_.jsx)(`div`,{className:`flex h-full min-h-[16rem] items-center justify-center p-8 text-center text-muted-foreground`,children:a(`activity:skillDetail.noContent`)})}),(0,_.jsx)(_e,{open:!!W,onOpenChange:e=>{e||G(null)},children:(0,_.jsxs)(he,{className:`flex max-h-[calc(100dvh-2rem)] w-[380px] max-w-[90vw] flex-col gap-0 overflow-hidden p-0`,showCloseButton:!1,children:[(0,_.jsxs)(me,{className:`flex shrink-0 items-center justify-between border-b border-border/70 p-4 sm:flex-row sm:justify-between sm:space-y-0`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-destructive`}),(0,_.jsx)(ge,{className:`font-semibold text-sm`,children:a(`activity:skillDetail.uninstallSkillHeading`)})]}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),"aria-label":a(`common:action.close`),className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground`,children:(0,_.jsx)(o,{className:`h-4 w-4`})})]}),(0,_.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm`,children:W&&a(`activity:skillDetail.uninstallConfirm`,{name:W.name})}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W&&a(`activity:skillDetail.uninstallRemovePath`,{path:W.path})})]}),(0,_.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-border/70 bg-muted/20 p-4`,children:[(0,_.jsx)(`button`,{type:`button`,onClick:()=>G(null),disabled:K,className:`rounded-md border border-border/70 px-3 py-1.5 text-xs transition-colors hover:bg-accent disabled:opacity-50`,children:a(`common:action.cancel`)}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>W&&He(W),disabled:K,className:`flex items-center gap-1.5 rounded-md bg-destructive px-3 py-1.5 text-xs text-destructive-foreground transition-colors hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50`,children:[K&&(0,_.jsx)(r,{className:`h-3 w-3 animate-spin`}),a(`activity:skillDetail.uninstallAction`)]})]})]})})]}):(0,_.jsx)(ye,{icon:(0,_.jsx)(re,{className:`h-6 w-6`}),title:a(`activity:skillDetail.noSkillSelected`),description:a(`activity:skillDetail.selectSkillHint`),action:{label:a(`activity:skillDetail.goToChat`),onClick:$},className:e})}export{y as SkillDetailView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ai as t,Ii as n,Ir as r,Kn as i,On as a,Ri as o,Sa as s,Si as c,Wn as l,_a as u,at as d,ea as f,et as p,gi as m,in as h,mn as g,nr as _,xi as v}from"./vendor-2VBBgNb5.js";import"./i18n-1BkaqMgr.js";import{t as y}from"./useWebSocket-Dh3aAFDE.js";import{t as b}from"./utils-CN2sfDVP.js";import{r as x}from"./stores-mpa0202y.js";import{r as S}from"./view-navigation-Cgy5xh9q.js";import{t as C}from"./button-uGqXvobk.js";var w=e(s(),1),T=p(),E={completed:{icon:(0,T.jsx)(t,{className:`h-3.5 w-3.5`}),label:`Completed`,text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(i,{className:`h-3.5 w-3.5 animate-spin`}),label:`Running`,text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(m,{className:`h-3.5 w-3.5`}),label:`Queued`,text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(l,{className:`h-3.5 w-3.5`}),label:`Blocked`,text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(v,{className:`h-3.5 w-3.5`}),label:`Pending`,text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),label:`Review`,text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),label:`Failed`,text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),label:`Cancelled`,text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{label:`Crit`,cls:`bg-destructive/10 text-destructive`},high:{label:`High`,cls:`bg-destructive/10 text-destructive`},medium:{label:`Med`,cls:`bg-warning/12 text-warning`},low:{label:`Low`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:r}=u();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:r(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:r(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((r,i)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:r.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:r.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),i<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(n,{className:`h-5 w-5`})})]},r.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:a}=u();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:r.label})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?a(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(i,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:t}){let{client:i}=y(),{t:s}=u(),c=x(e=>e.specs),l=x(e=>e.detail),f=x(e=>e.expandedSpecId),p=x(e=>e.setExpanded),[m,h]=(0,w.useState)(`graph`),v=(0,w.useCallback)(e=>{!l||l.specId!==e.id||(i?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(l),autonomous:!0}}),S(`goal`))},[l,i]),E=(0,w.useCallback)(e=>{let n=e.graphId??(l?.specId===e.id?l.graphId:void 0);n?i?.send?.({type:`sdd.run.from_graph`,payload:{graphId:n,worktrees:!0}}):i?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),S(`sddhub`)},[l,i,t]);(0,w.useEffect)(()=>{i?.send?.({type:`specs.list`})},[i]);let D=(0,w.useCallback)(e=>{f===e.id?p(null):(p(e.id),i?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[f,p,i]),O=l?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(r,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:s(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(d,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:c.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:s(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:c.map(e=>{let t=f===e.id,i=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(o,{className:`h-4 w-4`}):(0,T.jsx)(n,{className:`h-4 w-4`})}),(0,T.jsx)(r,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${i}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[s(`activity:specs.tasks`,{count:l?.total??e.total}),l&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:s(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:s(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:s(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:s(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!l||l.specId!==e.id,onClick:()=>v(e),title:s(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(g,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,m===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>h(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,m===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(a,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.graph`)]})]})]})]}),!l||l.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:s(`activity:specs.loadingTasks`)}):m===`graph`?(0,T.jsx)(k,{columns:l.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Dn as n,Fi as r,Fr as i,Gn as a,Li as o,Un as s,bi as c,et as l,fn as u,hi as d,ki as f,nn as p,nt as m,tr as h,wa as g,xi as _,ya as v}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{t as y}from"./useWebSocket-BVFPigcY.js";import{t as b}from"./utils-CwJvjOcH.js";import{r as x}from"./stores-DyQOSkkD.js";import{r as S}from"./view-navigation-BMRzqGbq.js";import{t as C}from"./button-BMECp1cg.js";var w=e(g(),1),T=l(),E={completed:{icon:(0,T.jsx)(f,{className:`h-3.5 w-3.5`}),label:`Completed`,text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,T.jsx)(a,{className:`h-3.5 w-3.5 animate-spin`}),label:`Running`,text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,T.jsx)(d,{className:`h-3.5 w-3.5`}),label:`Queued`,text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),label:`Blocked`,text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),label:`Pending`,text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),label:`Review`,text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),label:`Failed`,text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,T.jsx)(t,{className:`h-3.5 w-3.5`}),label:`Cancelled`,text:`text-muted-foreground`,ring:`border-border/70`}},D=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],O={critical:{label:`Crit`,cls:`bg-destructive/10 text-destructive`},high:{label:`High`,cls:`bg-destructive/10 text-destructive`},medium:{label:`Med`,cls:`bg-warning/12 text-warning`},low:{label:`Low`,cls:`bg-success/12 text-success`}};function k({columns:e,onTaskClick:t}){let{t:n}=v();return e.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,T.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,T.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:D.map(e=>(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5`,E[e].text),children:[E[e].icon,(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,T.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,i)=>(0,T.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,T.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,T.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,T.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,T.jsx)(A,{task:e,onClick:t},e.id))})]}),i<e.length-1&&(0,T.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,T.jsx)(r,{className:`h-5 w-5`})})]},n.label))})]})}function A({task:e,onClick:t}){let n=E[e.displayStatus],r=O[e.priority],{t:i}=v();return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:b(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:b(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,T.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,T.jsx)(`span`,{className:b(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:r.label})]}),(0,T.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,T.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,T.jsxs)(`div`,{className:b(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?i(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,T.jsx)(a,{className:`h-3 w-3 animate-spin`}),(0,T.jsx)(`span`,{children:e.agentName})]})]})}function j(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function M({onClose:e,onRunStarted:t}){let{client:a}=y(),{t:s}=v(),c=x(e=>e.specs),l=x(e=>e.detail),d=x(e=>e.expandedSpecId),f=x(e=>e.setExpanded),[p,g]=(0,w.useState)(`graph`),_=(0,w.useCallback)(e=>{!l||l.specId!==e.id||(a?.send?.({type:`goal.start`,payload:{title:e.title,phases:j(l),autonomous:!0}}),S(`goal`))},[l,a]),E=(0,w.useCallback)(e=>{let n=e.graphId??(l?.specId===e.id?l.graphId:void 0);n?a?.send?.({type:`sdd.run.from_graph`,payload:{graphId:n,worktrees:!0}}):a?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),S(`sddhub`)},[l,a,t]);(0,w.useEffect)(()=>{a?.send?.({type:`specs.list`})},[a]);let D=(0,w.useCallback)(e=>{d===e.id?f(null):(f(e.id),a?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[d,f,a]),O=l?.columns.flatMap(e=>e.tasks)??[],A={done:O.filter(e=>e.status===`completed`).length,running:O.filter(e=>e.status===`in_progress`).length,pending:O.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,T.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(i,{className:`h-5 w-5 text-warning`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:s(`activity:specs.heading`)}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`activity:specs.subtitle`)})]})]}),(0,T.jsx)(C,{variant:`ghost`,size:`icon`,onClick:e,children:(0,T.jsx)(m,{className:`h-4 w-4`})})]}),(0,T.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:c.length===0?(0,T.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:s(`activity:specs.empty`,{command:`/sdd`})}):(0,T.jsx)(`div`,{className:`space-y-3`,children:c.map(e=>{let t=d===e.id,a=e.total>0?Math.round(e.completed/e.total*100):0;return(0,T.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>D(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,T.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,T.jsx)(o,{className:`h-4 w-4`}):(0,T.jsx)(r,{className:`h-4 w-4`})}),(0,T.jsx)(i,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,T.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,T.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${a}%`}})}),(0,T.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,T.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{className:`text-sm font-medium`,children:[s(`activity:specs.tasks`,{count:l?.total??e.total}),l&&(0,T.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`text-success`,children:s(`activity:specs.doneCount`,{count:A.done})}),` `,(0,T.jsx)(`span`,{className:`text-primary`,children:s(`activity:specs.runningCount`,{count:A.running})}),` `,(0,T.jsx)(`span`,{children:s(`activity:specs.pendingCount`,{count:A.pending})})]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>E(e),title:s(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.runAsSdd`)]}),(0,T.jsxs)(`button`,{type:`button`,disabled:!l||l.specId!==e.id,onClick:()=>_(e),title:s(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,T.jsx)(u,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.runAsGoal`)]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>g(`list`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(h,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.list`)]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>g(`graph`),className:b(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,p===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,T.jsx)(n,{className:`h-3.5 w-3.5`}),` `,s(`activity:specs.graph`)]})]})]})]}),!l||l.specId!==e.id?(0,T.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:s(`activity:specs.loadingTasks`)}):p===`graph`?(0,T.jsx)(k,{columns:l.columns}):(0,T.jsx)(`div`,{className:`space-y-1.5`,children:O.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,T.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,T.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}export{M as SpecsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,Ct as n,Gn as r,Ki as i,Pt as a,Rt as o,Tn as s,Xr as c,Yt as l,ci as u,da as d,et as f,fi as p,jn as m,mi as h,nt as ee,oa as g,on as te,qi as _,rn as v,ti as ne,tt as y,wa as b,wr as x,xr as S}from"./vendor-BTTkQ9Tn.js";import{t as C}from"./utils-CwJvjOcH.js";import{n as w}from"./stores-DyQOSkkD.js";import{t as T}from"./button-BMECp1cg.js";import{t as E}from"./input-Bd10nfMj.js";import{C as D,S as O}from"./index-x6-rLl5H.js";var k=e(b(),1),A=f(),re={current:{label:`Current`,badge:`border-success/35 bg-success/10 text-success`,dot:`bg-success`,weight:0},update_available_safe:{label:`Update available`,badge:`border-info/35 bg-info/10 text-info`,dot:`bg-info`,weight:30},update_available_breaking:{label:`Major update`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:50},vulnerable:{label:`Vulnerable`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:100},deprecated:{label:`Deprecated`,badge:`border-destructive/35 bg-destructive/10 text-destructive`,dot:`bg-destructive`,weight:70},yanked:{label:`Yanked`,badge:`border-destructive/45 bg-destructive/15 text-destructive`,dot:`bg-destructive`,weight:80},unmaintained_suspected:{label:`Unmaintained?`,badge:`border-warning/35 bg-warning/10 text-warning`,dot:`bg-warning`,weight:60},blocked_by_constraints:{label:`Blocked`,badge:`border-warning/30 bg-warning/5 text-warning`,dot:`bg-warning`,weight:40},private_or_unresolved:{label:`Private`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:10},local_path:{label:`Local path`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},git_dependency:{label:`Git`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unsupported:{label:`Unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:5},unknown:{label:`Unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:20}},ie={label:`Unknown`,badge:`border-border/70 bg-muted text-muted-foreground`,dot:`bg-muted-foreground`,weight:0};function j(e){return re[e]??ie}var M={npm:{label:`npm / Node.js`,icon:s},python:{label:`Python`,icon:p},rust:{label:`Rust`,icon:o},go:{label:`Go`,icon:v},dotnet:{label:`.NET`,icon:m},php:{label:`PHP`,icon:n},dart:{label:`Dart / Flutter`,icon:u},maven:{label:`Maven`,icon:d},gradle:{label:`Gradle`,icon:_},ruby:{label:`Ruby`,icon:S},swift:{label:`Swift`,icon:y},elixir:{label:`Elixir`,icon:n},cpp:{label:`C / C++`,icon:h}},N={label:`Unknown`};function P(e){return M[e]??N}function F({ecosystem:e,className:t=`size-3.5 shrink-0`}){let n=P(e);if(!n.icon)return null;let r=n.icon;return(0,A.jsx)(r,{className:t})}function ae(e){return j(e.status).weight>=50}var I=[`critical`,`high`,`medium`,`low`,`info`],L={critical:{label:`Critical`,badge:`border-destructive/45 bg-destructive/15 text-destructive`},high:{label:`High`,badge:`border-destructive/35 bg-destructive/10 text-destructive`},medium:{label:`Medium`,badge:`border-warning/35 bg-warning/10 text-warning`},low:{label:`Low`,badge:`border-info/35 bg-info/10 text-info`},info:{label:`Info`,badge:`border-border/70 bg-muted text-muted-foreground`}},R={none:`No action`,upgrade_patch:`Patch upgrade`,upgrade_minor:`Minor upgrade`,upgrade_major:`Major upgrade`,replace:`Replace`,remove:`Remove`,investigate:`Investigate`},z={full:{label:`Full`,badge:`border-success/35 bg-success/10 text-success`,note:void 0},partial:{label:`Partial`,badge:`border-warning/35 bg-warning/10 text-warning`,note:`limited`},unsupported:{label:`Unsupported`,badge:`border-border/70 bg-muted text-muted-foreground`,note:`best-effort`}};function B(e){return z[e]??z.unsupported}function V(e){if(!e)return null;let t=/^\D*(\d+)/.exec(e);if(!t?.[1])return null;let n=Number(t[1]);return Number.isFinite(n)?n:null}function H(e){let t=V(e.locked??e.installed??e.requested),n=V(e.latestStable);if(t===null||n===null||n<=t)return{majorsBehind:0,label:null};let r=n-t;return{majorsBehind:r,label:`${r} major${r===1?``:`s`} behind`}}function U(e){return e.locked??e.installed??e.requested??null}function W(e){return e.confidence<1}function G({className:e,children:t}){return(0,A.jsx)(`span`,{className:C(`inline-flex shrink-0 items-center gap-1 border px-1.5 py-0.5 text-[10px] font-medium`,e),children:t})}function K({label:e,value:t,hint:n,tone:r=`default`}){let i={default:`text-foreground`,success:`text-success`,warning:`text-warning`,info:`text-info`,destructive:`text-destructive`}[r];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/55 px-3 py-2.5 shadow-[inset_0_1px_0_hsl(var(--foreground)/0.035)]`,children:[(0,A.jsx)(`p`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:e}),(0,A.jsxs)(`div`,{className:`mt-1 flex items-end justify-between gap-2`,children:[(0,A.jsx)(`p`,{className:C(`font-mono text-xl font-bold tabular-nums`,i),children:t}),(0,A.jsx)(`p`,{className:`truncate text-[9px] text-muted-foreground`,children:n})]})]})}function oe({dependency:e,findings:t,deepDive:n,onDeepDive:i,onBack:o,coverage:s}){let l=j(e.status),u=U(e),d=H(e),f=s?B(s).note:void 0;return(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`header`,{className:`shrink-0 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:o,"aria-label":`Back to dependency list`,className:`shrink-0 md:hidden`,children:(0,A.jsx)(g,{className:`size-4`})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`h2`,{className:`min-w-0 truncate font-mono text-sm font-bold text-foreground`,children:e.name}),(0,A.jsx)(G,{className:l.badge,children:l.label})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[P(e.ecosystem).label,` ·`,` `,e.direct?`direct`:`transitive`,` · `,e.scope,` ·`,` `,e.sourceType,f&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,A.jsx)(`span`,{className:`text-warning`,children:f})]})]})]})]}),(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-baseline gap-2 font-mono text-xs`,children:[(0,A.jsx)(`span`,{className:`text-foreground`,children:u??`—`}),e.latestStable&&e.latestStable!==u&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`text-info`,children:e.latestStable})]}),d.label&&(0,A.jsxs)(`span`,{className:`text-[10px] text-warning`,children:[`(`,d.label,`)`]})]})]}),(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`dl`,{className:`grid grid-cols-2 gap-px border border-border/70 bg-border/60`,children:[(0,A.jsx)(q,{label:`Constraint`,value:e.requested??`—`,mono:!0}),(0,A.jsx)(q,{label:`Locked`,value:e.locked??`—`,mono:!0}),(0,A.jsx)(q,{label:`Latest stable`,value:e.latestStable??`—`,mono:!0}),(0,A.jsx)(q,{label:`License`,value:e.license??`—`}),e.wanted&&(0,A.jsx)(q,{label:`Wanted`,value:e.wanted,mono:!0}),e.resolvable&&(0,A.jsx)(q,{label:`Resolvable`,value:e.resolvable,mono:!0}),e.purl&&(0,A.jsx)(q,{label:`PURL`,value:e.purl,mono:!0}),(0,A.jsx)(q,{label:`Registry flags`,value:[e.deprecated&&`deprecated`,e.yanked&&`yanked`].filter(Boolean).join(`, `)||`none`})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:`Findings`}),(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>i(e),disabled:n.status===`loading`,className:`h-7 text-[10px]`,children:[n.status===`loading`?(0,A.jsx)(r,{className:`size-3 animate-spin`}):(0,A.jsx)(a,{className:`size-3`}),n.status===`loading`?`Researching…`:`Deep dive`]})]}),n.status===`error`&&n.error&&(0,A.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-[10px] text-destructive`,children:n.error}),t.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Nothing flagged. Run a deep dive to have the model research this package against the web.`}):(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:L[e.severity].badge,children:L[e.severity].label}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]??e.action}),W(e)&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(a,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk})]},e.id))})]}),(0,A.jsxs)(`section`,{className:`mt-4`,children:[(0,A.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-bold uppercase tracking-[0.16em] text-muted-foreground`,children:`Evidence`}),e.evidence.length===0?(0,A.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`No evidence recorded.`}):(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.evidence.map((t,n)=>(0,A.jsxs)(`li`,{className:`border border-border/70 bg-card/40 p-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:t.kind}),(0,A.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(t.retrievedAt).toLocaleString()})]}),t.source.startsWith(`http`)?(0,A.jsxs)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`mt-1 flex min-w-0 items-center gap-1 truncate text-[10px] text-info underline-offset-2 hover:underline`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:t.source}),(0,A.jsx)(c,{className:`size-2.5 shrink-0`})]}):(0,A.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:t.source}),t.detail&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[10px] leading-relaxed text-muted-foreground`,children:t.detail})]},`${e.id}-evidence-${n}`))})]})]})]})}function q({label:e,value:t,mono:n}){return(0,A.jsxs)(`div`,{className:`bg-card/55 px-2.5 py-1.5`,children:[(0,A.jsx)(`dt`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`,children:e}),(0,A.jsx)(`dd`,{className:C(`mt-0.5 truncate text-[11px] text-foreground`,n&&`font-mono`),children:t})]})}var J=`grid grid-cols-[minmax(0,2.2fr)_minmax(0,1.6fr)_minmax(0,1.1fr)] gap-2`;function se({dependencies:e,selectedId:n,hasDependencies:r,coverageByWorkspaceId:i,onSelect:a}){let o=D(e,30);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:r?`No dependencies match the current filters.`:`No dependencies inventoried yet. Run a scan to populate the inventory.`})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsxs)(`div`,{className:C(J,`shrink-0 border-b border-border/70 bg-card/45 px-3 py-1.5 text-[9px] font-bold uppercase tracking-[0.14em] text-muted-foreground`),children:[(0,A.jsx)(`span`,{children:`Package`}),(0,A.jsx)(`span`,{children:`Installed → Latest`}),(0,A.jsx)(`span`,{children:`Status`})]}),(0,A.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,A.jsx)(t,{className:`h-full`,"aria-label":`Dependencies`,children:o.pageItems.map(e=>(0,A.jsx)(Y,{dependency:e,selected:e.id===n,coverage:i?.get(e.workspaceId),onSelect:a},e.id))})}),(0,A.jsx)(O,{page:o.page,pageSize:o.pageSize,totalItems:o.totalItems,onPageChange:o.setPage,itemLabel:`dependencies`})]})}function Y({dependency:e,selected:t,coverage:n,onSelect:r}){let i=j(e.status),a=U(e),o=H(e),s=n?B(n).note:void 0;return(0,A.jsxs)(`button`,{type:`button`,onClick:()=>r(e),"aria-current":t,className:C(J,`w-full items-center border-b border-border/40 px-3 py-2 text-left transition-colors hover:bg-accent/40`,t&&`bg-accent/60`),children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:C(`size-1.5 shrink-0`,i.dot),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-xs text-foreground`,children:e.name})]}),(0,A.jsxs)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem,className:`mr-0.5 inline-block size-3 align-text-bottom`}),P(e.ecosystem).label,` · `,e.direct?`direct`:`transitive`,` · `,e.scope,s&&(0,A.jsxs)(A.Fragment,{children:[` · `,(0,A.jsx)(`span`,{className:`text-warning`,children:s})]})]})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 font-mono text-[11px]`,children:[(0,A.jsx)(`span`,{className:`truncate text-foreground`,children:a??`—`}),e.latestStable&&e.latestStable!==a&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),(0,A.jsx)(`span`,{className:`truncate text-info`,children:e.latestStable})]})]}),o.label?(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-warning`,children:o.label}):e.requested&&(0,A.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:e.requested})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,A.jsx)(G,{className:i.badge,children:i.label}),e.deprecated&&(0,A.jsx)(G,{className:`border-destructive/35 bg-destructive/10 text-destructive`,children:`dep`}),e.yanked&&(0,A.jsx)(G,{className:`border-destructive/45 bg-destructive/15 text-destructive`,children:`yank`})]})]})}function ce({findings:e,dependenciesById:t,onSelectDependency:n}){let r=D(e,20);return e.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsxs)(`p`,{className:`max-w-sm text-xs text-muted-foreground`,children:[`No findings. Run `,(0,A.jsx)(`span`,{className:`font-mono text-foreground`,children:`Analyze`}),` to check versions and advisories against upstream registries, then interpret the results.`]})}):(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:I.map(e=>[e,r.pageItems.filter(t=>t.severity===e)]).filter(([,e])=>e.length>0).map(([e,r])=>(0,A.jsxs)(`section`,{children:[(0,A.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2`,children:[(0,A.jsx)(G,{className:L[e].badge,children:L[e].label}),(0,A.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums text-muted-foreground`,children:r.length})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:r.map(e=>(0,A.jsx)(X,{finding:e,dependency:t.get(e.dependencyId),onSelectDependency:n},e.id))})]},e))})}),(0,A.jsx)(O,{page:r.page,pageSize:r.pageSize,totalItems:r.totalItems,onPageChange:r.setPage,itemLabel:`findings`})]})}function X({finding:e,dependency:t,onSelectDependency:n}){let r=W(e);return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>n(e.dependencyId),className:`min-w-0 truncate font-mono text-xs text-foreground underline-offset-2 hover:underline`,children:t?.name??e.dependencyId}),(0,A.jsx)(G,{className:`border-border/70 bg-muted text-muted-foreground`,children:R[e.action]??e.action}),r&&(0,A.jsxs)(G,{className:`border-info/35 bg-info/10 text-info`,children:[(0,A.jsx)(a,{className:`size-2.5`}),`AI · `,Math.round(e.confidence*100),`%`]})]}),(0,A.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-muted-foreground`,children:e.rationale}),e.breakingRisk&&(0,A.jsx)(`p`,{className:`mt-1 border-l-2 border-warning/40 pl-2 text-[10px] leading-relaxed text-warning`,children:e.breakingRisk}),e.evidence.length>0&&(0,A.jsx)(`ul`,{className:C(`mt-1.5 flex flex-col gap-0.5`),children:e.evidence.slice(0,4).map((t,n)=>(0,A.jsx)(`li`,{className:`min-w-0 truncate text-[10px]`,children:t.source.startsWith(`http`)?(0,A.jsx)(`a`,{href:t.source,target:`_blank`,rel:`noreferrer noopener`,className:`text-info underline-offset-2 hover:underline`,children:t.detail??t.source}):(0,A.jsx)(`span`,{className:`text-muted-foreground`,children:t.detail??t.source})},`${e.id}-${n}`))})]})}function le({searchQuery:e,ecosystemFilter:t,statusFilter:n,directOnly:r,sort:i,hasFilters:a,ecosystems:o,statuses:s,visibleCount:c,totalCount:u,onSearchChange:d,onEcosystemFilterChange:f,onStatusFilterChange:p,onToggleDirectOnly:m,onSortChange:h,onClearFilters:g}){return(0,A.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/70 bg-card/45 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,A.jsx)(l,{className:`pointer-events-none absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,A.jsx)(E,{"aria-label":`Search dependencies`,value:e,onChange:e=>d(e.target.value),placeholder:`Search by package name…`,className:`h-10 min-w-0 bg-background pl-9 pr-8 text-xs`}),e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>d(``),className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground`,children:(0,A.jsx)(ee,{className:`size-3.5`})})]}),(0,A.jsx)(T,{variant:r?`default`:`outline`,size:`sm`,onClick:m,"aria-pressed":r,title:`Show only dependencies this project declares itself`,className:`shrink-0`,children:`Direct only`}),a&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:g,"aria-label":`Clear all filters`,title:`Clear all filters`,className:`shrink-0`,children:(0,A.jsx)(x,{className:`size-4`})})]}),(0,A.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-ecosystem-filter`,children:`Filter by ecosystem`}),(0,A.jsxs)(`select`,{id:`techstack-ecosystem-filter`,value:t,onChange:e=>f(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:`All ecosystems`}),o.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[P(e).label,` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-status-filter`,children:`Filter by status`}),(0,A.jsxs)(`select`,{id:`techstack-status-filter`,value:n,onChange:e=>p(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`all`,children:`All statuses`}),s.map(([e,t])=>(0,A.jsxs)(`option`,{value:e,children:[j(e).label,` · `,t]},e))]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`sr-only`,htmlFor:`techstack-sort`,children:`Sort dependencies`}),(0,A.jsxs)(`select`,{id:`techstack-sort`,value:i,onChange:e=>h(e.target.value),className:`h-9 w-full min-w-0 border border-input bg-background px-2 text-xs`,children:[(0,A.jsx)(`option`,{value:`attention`,children:`Sort: needs attention`}),(0,A.jsx)(`option`,{value:`drift`,children:`Sort: most out of date`}),(0,A.jsx)(`option`,{value:`name`,children:`Sort: name`})]})]})]}),(0,A.jsx)(`p`,{className:C(`text-[10px] text-muted-foreground`,a&&`text-info`),children:c===u?`${u} dependencies`:`${c} of ${u} dependencies`})]})}var ue=[{id:`dependencies`,label:`Dependencies`},{id:`findings`,label:`Findings`},{id:`workspaces`,label:`Workspaces`},{id:`trends`,label:`Trends`},{id:`remediation`,label:`Remediation`}],Z=new Set([`npm`,`python`,`rust`,`go`,`php`,`dotnet`]);function de(){let e=w(e=>e.snapshot),t=w(e=>e.stale),n=w(e=>e.loading),i=w(e=>e.error),o=w(e=>e.activeJob),[s,c]=(0,k.useState)(`dependencies`),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(`all`),[p,m]=(0,k.useState)(`all`),[h,g]=(0,k.useState)(!1),[_,v]=(0,k.useState)(`attention`),[y,b]=(0,k.useState)(null),[x,S]=(0,k.useState)([]),[E,D]=(0,k.useState)({status:`idle`,error:null}),[O,re]=(0,k.useState)(null),[ie,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(new Set),[F,I]=(0,k.useState)(!1),L=(0,k.useCallback)(async()=>{let e=w.getState();e.setLoading(!0),e.setError(null);try{let t=await fetch(`/api/techstack/snapshot`);if(t.status===404){e.setSnapshot(null,!1);return}if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);let n=await t.json();e.setSnapshot(n.snapshot,n.stale)}catch(t){e.setError(t instanceof Error?t.message:String(t))}},[]),R=(0,k.useCallback)(async e=>{let t=w.getState();t.setLoading(!0),t.setError(null);try{let n=await fetch(`/api/techstack/${e}`,{method:`POST`}),r=await n.json();if(!n.ok||!r.jobId)throw Error(r.error??`HTTP ${n.status}: ${n.statusText}`);t.jobStarted(r.jobId,e)}catch(e){t.setError(e instanceof Error?e.message:String(e))}},[]),z=(0,k.useCallback)(async()=>{let e=w.getState().activeJob;if(e)try{let t=await fetch(`/api/techstack/jobs/${encodeURIComponent(e.id)}/cancel`,{method:`POST`});if(!t.ok)throw Error(`HTTP ${t.status}: ${t.statusText}`);w.getState().jobCancelled(e.id)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}},[]),B=(0,k.useCallback)(async e=>{D({status:`loading`,error:null});try{let t=await fetch(`/api/techstack/deps/${encodeURIComponent(e.id)}/research`,{method:`POST`}),n=await t.json();if(!t.ok)throw Error(n.error??`HTTP ${t.status}`);S(n.findings??[]),D({status:`idle`,error:null})}catch(e){D({status:`error`,error:e instanceof Error?e.message:String(e)})}},[]);(0,k.useEffect)(()=>{L()},[L]),(0,k.useEffect)(()=>{s!==`trends`&&s!==`remediation`||fetch(`/api/techstack/${s===`trends`?`trends`:`remediation`}`).then(async e=>{let t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);t.trend&&re(t.trend),t.plan&&M(t.plan)}).catch(e=>w.getState().setError(e instanceof Error?e.message:String(e)))},[s,e?.id]);let V=(0,k.useCallback)(async()=>{if(N.size!==0){I(!0);try{let e=await fetch(`/api/techstack/remediation/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvedItems:[...N]})}),t=await e.json();if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);P(new Set),await R(`inventory`)}catch(e){w.getState().setError(e instanceof Error?e.message:String(e))}finally{I(!1)}}},[N,R]);(0,k.useEffect)(()=>{S([]),D({status:`idle`,error:null})},[e?.id]);let U=(0,k.useMemo)(()=>e?.dependencies??[],[e]),W=(0,k.useMemo)(()=>e?.findings??[],[e]),G=(0,k.useMemo)(()=>new Map(U.map(e=>[e.id,e])),[U]),q=(0,k.useMemo)(()=>ge(U.map(e=>e.ecosystem)),[U]),J=(0,k.useMemo)(()=>ge(U.map(e=>e.status)),[U]),Y=(0,k.useMemo)(()=>new Map(e?.workspaces.map(e=>[e.id,e.coverage])??[]),[e]),X=(0,k.useMemo)(()=>{let e=l.trim().toLowerCase(),t=[...U.filter(t=>!(e&&!t.name.toLowerCase().includes(e)||d!==`all`&&t.ecosystem!==d||p!==`all`&&t.status!==p||h&&!t.direct))];return _===`name`?t.sort((e,t)=>e.name.localeCompare(t.name)):_===`drift`?t.sort((e,t)=>H(t).majorsBehind-H(e).majorsBehind||e.name.localeCompare(t.name)):t.sort((e,t)=>j(t.status).weight-j(e.status).weight||Number(t.direct)-Number(e.direct)||e.name.localeCompare(t.name)),t},[U,l,d,p,h,_]),Z=y?G.get(y):void 0,de=(0,k.useMemo)(()=>Z?[...W.filter(e=>e.dependencyId===Z.id),...x.filter(e=>e.dependencyId===Z.id)]:[],[W,x,Z]),ve=(0,k.useMemo)(()=>U.filter(ae).length,[U]),ye=(0,k.useMemo)(()=>U.filter(e=>H(e).majorsBehind>0).length,[U]),be=(0,k.useMemo)(()=>U.filter(e=>e.status===`vulnerable`).length,[U]),xe=l.trim()!==``||d!==`all`||p!==`all`||h,Se=(0,k.useCallback)(()=>{u(``),f(`all`),m(`all`),g(!1)},[]),$=!!(o&&![`completed`,`failed`,`cancelled`].includes(o.status)),Ce=(0,k.useCallback)(e=>{b(e),c(`dependencies`)},[]);return(0,A.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,A.jsx)(`header`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-base font-bold sm:text-lg`,children:`TechStack`}),(0,A.jsx)(`span`,{className:`border border-info/35 bg-info/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-info`,children:e?`${e.workspaces.length} workspaces`:`no scan yet`}),t&&(0,A.jsx)(`span`,{className:`border border-warning/35 bg-warning/10 px-2 py-0.5 font-mono text-[9px] font-bold uppercase text-warning`,children:`stale >24h`})]}),(0,A.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-muted-foreground sm:text-xs`,children:e?`${e.targetRoot} · scanned ${new Date(e.createdAt).toLocaleString()}`:`Scan the open project to inventory its dependencies.`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsxs)(T,{variant:`outline`,size:`sm`,onClick:()=>void R(`inventory`),disabled:$,title:`Offline: re-read manifests and lockfiles`,children:[(0,A.jsx)(te,{className:C(`size-3.5`,$&&`animate-spin`)}),(0,A.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]}),(0,A.jsxs)(T,{size:`sm`,onClick:()=>void R(`analyze`),disabled:$,title:`Check registries and advisories, then interpret the results with the model`,children:[(0,A.jsx)(a,{className:`size-3.5`}),`Analyze`]}),$&&(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>void z(),"aria-label":`Cancel job`,children:(0,A.jsx)(ee,{className:`size-4`})}),(0,A.jsx)(T,{variant:`ghost`,size:`icon`,onClick:()=>e&&_e(e),disabled:!e,"aria-label":`Export snapshot as JSON`,title:`Export snapshot as JSON`,children:(0,A.jsx)(ne,{className:`size-4`})})]})]})}),e&&(0,A.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-px border-b border-border/70 bg-border/60 sm:grid-cols-4`,children:[(0,A.jsx)(K,{label:`Dependencies`,value:U.length,hint:`${X.length} visible`}),(0,A.jsx)(K,{label:`Outdated`,value:ye,hint:`majors behind`,tone:ye>0?`warning`:`success`}),(0,A.jsx)(K,{label:`Vulnerable`,value:be,hint:`known advisories`,tone:be>0?`destructive`:`success`}),(0,A.jsx)(K,{label:`Findings`,value:W.length,hint:`${ve} need attention`,tone:W.length>0?`info`:`default`})]}),($||i)&&(0,A.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-2`,"aria-live":`polite`,children:[$&&o&&(0,A.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-xs text-info`,children:[(0,A.jsx)(r,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`font-mono`,children:o.status}),o.progress&&(0,A.jsxs)(`span`,{className:`text-muted-foreground`,children:[o.progress.completed,`/`,o.progress.total]})]}),i&&(0,A.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 text-xs text-destructive`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`underline`,children:`Retry`})]})]}),n&&!e?(0,A.jsx)(Q,{}):e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`nav`,{className:`flex shrink-0 gap-1 border-b border-border/70 px-2`,children:ue.map(e=>(0,A.jsxs)(`button`,{type:`button`,onClick:()=>c(e.id),"aria-current":s===e.id,className:C(`border-b-2 px-3 py-2 text-xs font-medium transition-colors`,s===e.id?`border-primary text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.label,e.id===`findings`&&W.length>0&&(0,A.jsx)(`span`,{className:`ml-1.5 font-mono text-[10px] tabular-nums text-muted-foreground`,children:W.length})]},e.id))}),s===`dependencies`&&(0,A.jsxs)(`div`,{className:`grid min-h-0 flex-1 md:grid-cols-[minmax(340px,1fr)_minmax(0,1.15fr)]`,children:[(0,A.jsxs)(`section`,{className:C(`min-h-0 border-r border-border/70`,Z?`hidden md:flex md:flex-col`:`flex flex-col`),"aria-label":`Dependency list`,children:[(0,A.jsx)(le,{searchQuery:l,ecosystemFilter:d,statusFilter:p,directOnly:h,sort:_,hasFilters:xe,ecosystems:q,statuses:J,visibleCount:X.length,totalCount:U.length,onSearchChange:u,onEcosystemFilterChange:f,onStatusFilterChange:m,onToggleDirectOnly:()=>g(e=>!e),onSortChange:v,onClearFilters:Se}),(0,A.jsx)(se,{dependencies:X,selectedId:y,hasDependencies:U.length>0,coverageByWorkspaceId:Y,onSelect:e=>b(e.id)})]}),(0,A.jsx)(`section`,{className:C(`min-h-0`,Z?`flex flex-col`:`hidden md:flex md:flex-col`),"aria-label":`Dependency detail`,children:Z?(0,A.jsx)(oe,{dependency:Z,findings:de,deepDive:E,onDeepDive:B,onBack:()=>b(null),coverage:Y.get(Z.workspaceId)}):(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-center`,children:(0,A.jsx)(`p`,{className:`max-w-xs text-xs text-muted-foreground`,children:`Select a dependency to see its versions, evidence, and findings.`})})})]}),s===`findings`&&(0,A.jsx)(ce,{findings:W,dependenciesById:G,onSelectDependency:Ce}),s===`workspaces`&&(0,A.jsx)(me,{snapshot:e}),s===`trends`&&(0,A.jsx)(fe,{trend:O}),s===`remediation`&&(0,A.jsx)(pe,{plan:ie,approved:N,applying:F,onToggle:e=>P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onApply:()=>void V()})]}):(0,A.jsx)(he,{onScan:()=>void R(`inventory`),disabled:$})]})}function fe({trend:e}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[e.snapshots,` snapshots`,e.vulnerabilityHalfLifeMs===void 0?``:` · vulnerability half-life ${(e.vulnerabilityHalfLifeMs/864e5).toFixed(1)} days`]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.points.map(e=>(0,A.jsxs)(`div`,{className:`grid grid-cols-4 border border-border/70 bg-card/40 p-2 text-xs`,children:[(0,A.jsx)(`span`,{children:new Date(e.createdAt).toLocaleDateString()}),(0,A.jsxs)(`span`,{children:[e.dependencies,` deps`]}),(0,A.jsxs)(`span`,{className:`text-warning`,children:[e.outdated,` outdated`]}),(0,A.jsxs)(`span`,{className:`text-destructive`,children:[e.vulnerable,` vulnerable`]})]},e.snapshotId))})]}):(0,A.jsx)(Q,{})}function pe({plan:e,approved:t,applying:n,onToggle:i,onApply:a}){return e?(0,A.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:[(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.warning}),(0,A.jsxs)(T,{size:`sm`,disabled:t.size===0||n,onClick:a,children:[n&&(0,A.jsx)(r,{className:`size-3.5 animate-spin`}),`Apply `,t.size>0?t.size:``]})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e.items.map(e=>{let n=`${e.workspaceId}:${e.ecosystem}:${e.dependencyName}:${e.action}`,r=e.action===`replace`||e.action===`investigate`||!Z.has(e.ecosystem);return(0,A.jsxs)(`label`,{className:C(`flex gap-3 border border-border/70 bg-card/40 p-2.5`,r?`cursor-not-allowed opacity-65`:`cursor-pointer`),children:[(0,A.jsx)(`input`,{type:`checkbox`,disabled:r,checked:t.has(n),onChange:()=>i(n)}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`span`,{className:`block font-mono text-xs`,children:[e.dependencyName,` · `,e.action]}),(0,A.jsxs)(`span`,{className:`block text-[10px] text-muted-foreground`,children:[e.currentVersion??`?`,` → `,e.targetVersion??`latest`,` · `,e.rationale]}),r&&(0,A.jsx)(`span`,{className:`block text-[10px] text-warning`,children:`Requires a manual package choice.`})]})]},n)}),e.items.length===0&&(0,A.jsx)(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:`No remediation needed.`})]})]}):(0,A.jsx)(Q,{})}function me({snapshot:e}){let t=(0,k.useMemo)(()=>{let t=new Map;for(let n of e.dependencies)t.set(n.workspaceId,(t.get(n.workspaceId)??0)+1);return t},[e]);return e.workspaces.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No workspaces detected.`})}):(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-3`,children:(0,A.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.workspaces.map(e=>{let n=z[e.coverage];return(0,A.jsxs)(`div`,{className:`border border-border/70 bg-card/40 p-2.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`p`,{className:`truncate font-mono text-xs text-foreground`,children:e.relativeRoot}),(0,A.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1 truncate text-[10px] text-muted-foreground`,children:[(0,A.jsx)(F,{ecosystem:e.ecosystem}),(0,A.jsx)(`span`,{children:P(e.ecosystem).label}),e.packageManager?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsx)(`span`,{children:e.packageManager})]}):null,(0,A.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,A.jsxs)(`span`,{children:[t.get(e.id)??0,` deps`]})]})]}),(0,A.jsx)(`span`,{className:C(`shrink-0 border px-1.5 py-0.5 text-[10px] font-medium`,n.badge),children:n.label})]}),e.manifests.length>0&&(0,A.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.manifests.map(e=>(0,A.jsx)(`span`,{className:`border border-border/70 bg-background/45 px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:e.split(/[/\\]/).pop()},e))})]},e.id)})})})}function Q(){return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,A.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,A.jsx)(r,{className:`size-5 animate-spin text-muted-foreground`}),(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading snapshot…`})]})})}function he({onScan:e,disabled:t}){let n=(0,k.useMemo)(()=>Object.values(M).map(e=>e.label).join(`, `),[]);return(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,A.jsxs)(`div`,{className:`flex max-w-md flex-col items-center gap-3 text-center`,children:[(0,A.jsx)(`div`,{className:`flex size-14 items-center justify-center border border-info/25 bg-info/5 text-info`,children:(0,A.jsx)(i,{className:`size-6`})}),(0,A.jsx)(`h2`,{className:`text-sm font-semibold`,children:`No inventory yet`}),(0,A.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`TechStack reads every manifest and lockfile in the open project — `,n,` — and compares what you have against the upstream registries.`]}),(0,A.jsxs)(T,{size:`sm`,onClick:e,disabled:t,children:[(0,A.jsx)(te,{className:C(`size-3.5`,t&&`animate-spin`)}),`Scan this project`]})]})})}function ge(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}function _e(e){let t=new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`techstack.json`,r.click(),URL.revokeObjectURL(n)}export{de as TechStackView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Sa as t,dn as n,et as r,jt as i,nn as a,nt as o,wa as s,xt as c,ya as l}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{n as u}from"./ui-store-di6oY7cy.js";import{t as d}from"./ws-client-B0-KwuTK.js";import{n as f,t as p}from"./utils-CwJvjOcH.js";import{t as m}from"./session-store-ZMNU48xK.js";import{M as h}from"./stores-DyQOSkkD.js";import{n as g,t as _}from"./xterm-DUBp1lnG.js";var v=e(s(),1),y=`wrongstack.terminalDockHeight`;function b(e){let t=typeof window>`u`?640:Math.max(140,Math.min(640,Math.floor(window.innerHeight*.55),window.innerHeight-260));return Math.min(Math.max(Math.round(e),140),t)}var x=r(),S={background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,selectionBackground:`#585b70`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`},C=8;function w(e=!1){return typeof window>`u`?300:b(window.innerHeight*(e?.32:.4))}function T(e=!1){if(typeof window>`u`)return w(e);try{let t=window.localStorage.getItem(y),n=t?Number.parseInt(t,10):NaN;return Number.isFinite(n)?b(n):w(e)}catch{return w(e)}}function E(e){try{window.localStorage.setItem(y,String(b(e)))}catch{}}function D(){return f()}function O(e){return{id:D(),name:`Terminal ${e}`,status:`starting`}}function k({desktopShell:e=!1,onClose:t}){let r=(0,v.useRef)(null),{t:s}=l(),d=(0,v.useRef)(1),[f,h]=(0,v.useState)(()=>T(e)),[g,_]=(0,v.useState)(()=>[O(1)]),[y,S]=(0,v.useState)(()=>g[0]?.id??``),w=u(e=>e.terminalCreateNonce),k=(0,v.useRef)(w),j=m(e=>e.projectName),M=m(e=>e.cwd);(0,v.useEffect)(()=>{let e=()=>{h(e=>{let t=b(e);return E(t),t})};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let N=e=>{e.preventDefault(),r.current?.();let t=e.clientY,n=f,i=document.body.style.cursor,a=document.body.style.userSelect;document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`;let o=e=>{let r=b(n+t-e.clientY);h(r),E(r)},s=()=>{document.body.style.cursor=i,document.body.style.userSelect=a,window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s),r.current===s&&(r.current=null)};r.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s,{once:!0}),window.addEventListener(`pointercancel`,s,{once:!0})};(0,v.useEffect)(()=>()=>r.current?.(),[]);let P=()=>{_(e=>{if(e.length>=C)return e;d.current+=1;let t=O(d.current);return S(t.id),[...e,t]})};(0,v.useEffect)(()=>{w!==k.current&&(k.current=w,P())},[w]);let F=e=>{_(n=>{let r=n.findIndex(t=>t.id===e);if(r===-1)return n;let i=n.filter(t=>t.id!==e);return i.length===0?(queueMicrotask(t),i):(y===e&&S(i[Math.max(0,r-1)]?.id??i[0]?.id??``),i)})},I=e=>{let t=D();_(n=>{let r=!1,i=n.map(n=>n.id===e?(r=!0,{...n,id:t,status:`starting`,exitCode:void 0}):n);return r&&S(t),i})},L=()=>{_([]),S(``),queueMicrotask(t)},R=(e,t)=>{_(n=>n.map(n=>n.id===e?{...n,...t}:n))},z=g.find(e=>e.id===y)??g[0]??null;return(0,x.jsxs)(`div`,{"data-terminal-dock":!0,style:{height:f},"data-shell":e?`desktop`:`browser`,className:p(`z-30 flex min-h-0 shrink-0 flex-col border-t border-border/70 bg-card shadow-2xl`,e&&`ws-terminal-desktop`),children:[(0,x.jsx)(`hr`,{"aria-orientation":`horizontal`,tabIndex:0,title:s(`activity:terminal.resize`),onPointerDown:N,className:`h-1.5 cursor-ns-resize bg-muted/70 transition-colors hover:bg-primary/35 border-0`}),(0,x.jsxs)(`div`,{className:p(`flex min-w-0 items-center justify-between gap-3 border-b border-border/70 bg-card/85`,e?`px-2 py-1`:`px-3 py-1.5`),children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-foreground`,children:[(0,x.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,x.jsx)(`span`,{className:`font-medium`,children:s(e?`activity:terminal.labelSingular`:`activity:terminal.labelPlural`)}),(0,x.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:j||M||s(`activity:terminal.projectShell`)})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(`button`,{type:`button`,onClick:P,disabled:g.length>=C,title:g.length>=C?s(`activity:terminal.maxTerminals`,{count:C}):s(`activity:terminal.newTerminal`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(n,{className:`h-4 w-4`})}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>z&&I(z.id),disabled:!z,title:s(`activity:terminal.restart`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:L,disabled:g.length===0,title:s(`activity:terminal.closeAll`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,children:(0,x.jsx)(c,{className:`h-3.5 w-3.5`})}),(0,x.jsx)(`button`,{type:`button`,onClick:t,title:s(`activity:terminal.closeDock`),className:`inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,x.jsx)(o,{className:`h-4 w-4`})})]})]}),(0,x.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-1 overflow-x-auto border-b border-border/70 bg-[hsl(var(--surface-2)/0.45)]`,e?`px-1.5 py-0.5`:`px-2 py-1`),children:g.map(t=>(0,x.jsxs)(`div`,{className:p(`group inline-flex items-center rounded border text-xs transition-colors`,e?`h-6 min-w-[92px] max-w-[148px]`:`h-7 min-w-[112px] max-w-[180px]`,y===t.id?`border-primary/35 bg-primary/10 text-primary`:`border-transparent bg-transparent text-muted-foreground hover:bg-accent hover:text-foreground`),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>S(t.id),title:t.status===`exited`?`${t.name} exited`:t.name,className:`inline-flex min-w-0 flex-1 items-center gap-2 px-2 text-left`,children:[(0,x.jsx)(`span`,{className:p(`h-1.5 w-1.5 shrink-0 rounded-full`,t.status===`running`&&`bg-success`,t.status===`starting`&&`bg-primary`,t.status===`exited`&&`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[t.name,t.status===`exited`&&typeof t.exitCode==`number`?` (${t.exitCode})`:``]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F(t.id)},className:`mr-1 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground opacity-70 hover:bg-accent hover:text-foreground hover:opacity-100`,title:s(`activity:terminal.closeTab`,{name:t.name}),children:(0,x.jsx)(o,{className:`h-3 w-3`})})]},t.id))}),M&&!e&&(0,x.jsx)(`div`,{className:`min-w-0 truncate border-b border-border/60 bg-muted/30 px-3 py-1 text-[11px] font-mono text-muted-foreground`,children:M}),(0,x.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:g.map(e=>(0,x.jsx)(A,{id:e.id,active:e.id===y,onRunning:()=>R(e.id,{status:`running`}),onExit:t=>R(e.id,{status:`exited`,exitCode:t})},e.id))})]})}function A({id:e,active:n,onRunning:r,onExit:i}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)(r),l=(0,v.useRef)(i),u=h(e=>e.wsConnected);return(0,v.useEffect)(()=>{c.current=r,l.current=i},[i,r]),(0,v.useEffect)(()=>{let n=a.current;if(!n)return;let r=new _({fontFamily:`"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:13,cursorBlink:!0,theme:S,scrollback:5e3}),i=new g;o.current=r,s.current=i,r.loadAddon(i),r.open(n);try{i.fit()}catch{}let u=d(h.getState().wsUrl);u.send({type:`terminal.create`,payload:{id:e,cols:r.cols,rows:r.rows}});let f=!1,p=u.on(`terminal.output`,t=>{t.type===`terminal.output`&&t.payload.id===e&&(f||(f=!0,c.current()),r.write(t.payload.data))}),m=u.on(`terminal.exit`,n=>{n.type===`terminal.exit`&&n.payload.id===e&&(r.write(`\r\n\x1b[2m${t.t(`activity:terminal.processExited`,{code:n.payload.exitCode})}\x1b[0m\r\n`),l.current(n.payload.exitCode))}),v=r.onData(t=>{u.send({type:`terminal.input`,payload:{id:e,data:t}})}),y=new ResizeObserver(()=>{if(n.offsetParent)try{i.fit(),u.send({type:`terminal.resize`,payload:{id:e,cols:r.cols,rows:r.rows}})}catch{}});return y.observe(n),()=>{p(),m(),v.dispose(),y.disconnect(),u.send({type:`terminal.close`,payload:{id:e}}),r.dispose(),o.current=null,s.current=null}},[e,u]),(0,v.useEffect)(()=>{n&&window.requestAnimationFrame(()=>{try{s.current?.fit();let t=o.current;t&&(d(h.getState().wsUrl).send({type:`terminal.resize`,payload:{id:e,cols:t.cols,rows:t.rows}}),t.focus())}catch{}})},[n,e]),(0,x.jsx)(`div`,{ref:a,className:p(`absolute inset-0 min-h-0 min-w-0 overflow-hidden px-2 py-1`,n?`block`:`hidden`)})}export{k as TerminalPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Sa as t,et as n,ki as r,nt as i,sr as a,va as o,vt as s,wa as c,xi as l,ya as u}from"./vendor-BTTkQ9Tn.js";import"./i18n-2wGPPdl_.js";import{n as d,t as f}from"./utils-CwJvjOcH.js";var p=e(c(),1),m=n();function h(){return`toast_${d()}`}var g=8e3,_=o(e=>({toasts:[],push:t=>{let n=h();return e(e=>({toasts:[...e.toasts,{...t,id:n}]})),n},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),v={success:(e,t=3500)=>_.getState().push({message:e,variant:`success`,ttl:t}),error:(e,t=6e3)=>_.getState().push({message:e,variant:`error`,ttl:t}),warn:(e,t=4500)=>_.getState().push({message:e,variant:`warn`,ttl:t}),info:(e,t=3500)=>_.getState().push({message:e,variant:`info`,ttl:t}),undoable:(e,n,r=t.t(`common:action.undo`),i=g)=>_.getState().push({message:e,variant:`info`,ttl:i,action:{label:r,onClick:n}}),dismiss:e=>_.getState().dismiss(e)};function y({variant:e}){return e===`success`?(0,m.jsx)(r,{className:`h-4 w-4 text-success`}):e===`error`?(0,m.jsx)(l,{className:`h-4 w-4 text-destructive`}):e===`warn`?(0,m.jsx)(s,{className:`h-4 w-4 text-warning`}):(0,m.jsx)(a,{className:`h-4 w-4 text-info`})}function b({entry:e}){let{t}=u(),n=_(e=>e.dismiss);return(0,p.useEffect)(()=>{let t=setTimeout(()=>n(e.id),e.ttl);return()=>clearTimeout(t)},[e.id,e.ttl,n]),(0,m.jsxs)(`div`,{className:f(`flex items-start gap-2 rounded-lg border bg-popover shadow-lg px-3 py-2 text-sm max-w-sm`,`animate-message`,e.variant===`error`&&`border-destructive/40`,e.variant===`warn`&&`border-warning/40`,e.variant===`success`&&`border-success/40`),children:[(0,m.jsx)(y,{variant:e.variant}),(0,m.jsx)(`div`,{className:`flex-1 min-w-0 whitespace-pre-wrap break-words leading-snug`,children:e.message}),e.action&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>{e.action?.onClick(),n(e.id)},className:`shrink-0 font-medium text-primary hover:underline`,children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),className:`text-muted-foreground hover:text-foreground`,title:t(`activity:toast.dismiss`),"aria-label":t(`activity:toast.dismiss`),children:(0,m.jsx)(i,{className:`h-3.5 w-3.5`})})]})}function x(){let e=_(e=>e.toasts);return e.length===0?null:(0,m.jsx)(`section`,{className:`fixed bottom-4 right-4 z-[60] flex flex-col gap-2 pointer-events-auto`,"aria-label":`Notifications`,"aria-live":`polite`,children:e.map(e=>(0,m.jsx)(b,{entry:e},e.id))})}export{v as n,x as t};
|