@openscout/scout 0.2.95 → 0.2.96
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/bin/scout +26 -10
- package/bin/scoutd +0 -0
- package/dist/build-manifest.json +3 -3
- package/dist/client/assets/{ActivityScreen--eANwuxa.js → ActivityScreen-BnoaUkVZ.js} +1 -1
- package/dist/client/assets/{AddProjectForm-CcD6qvV8.js → AddProjectForm-IqOtJfRs.js} +1 -1
- package/dist/client/assets/{AgentAvatar-CYhf6twS.js → AgentAvatar-6-KBVKUu.js} +1 -1
- package/dist/client/assets/{AgentConfigurationScreen-BTI24HQX.js → AgentConfigurationScreen-CuZJy07q.js} +1 -1
- package/dist/client/assets/{AgentDefinitionsWorkspace-srmN6-vj.js → AgentDefinitionsWorkspace-Iyl4BesU.js} +1 -1
- package/dist/client/assets/{AgentDetailCard-UqPNpcvB.js → AgentDetailCard-C9rn3Fj5.js} +1 -1
- package/dist/client/assets/{AgentFloorView-XXNgI5Cj.js → AgentFloorView-YT-Jjccf.js} +1 -1
- package/dist/client/assets/{AgentInfoScreen-CimdOnZ9.js → AgentInfoScreen-Dr99gQEZ.js} +1 -1
- package/dist/client/assets/{AgentLaneCard-Z-aOBR3W.js → AgentLaneCard-DI2iW9zO.js} +1 -1
- package/dist/client/assets/{AgentLaneChrome-CyhA1reW.js → AgentLaneChrome-D8bARHMx.js} +1 -1
- package/dist/client/assets/{AgentLaneDetailSheet-BNzjMjIH.js → AgentLaneDetailSheet-52un7dKC.js} +1 -1
- package/dist/client/assets/{AgentLaneSummaryResize-Box8-_rS.js → AgentLaneSummaryResize-CEBjmPTa.js} +1 -1
- package/dist/client/assets/AgentLanesEmbedScreen-Dgcm7zd_.js +1 -0
- package/dist/client/assets/AgentLanesPreflight-q20mTjms.js +1 -0
- package/dist/client/assets/AgentLanesView-CetZZDyF.js +2 -0
- package/dist/client/assets/{AgentLiveActions-BwuzOE8h.js → AgentLiveActions-DrEJDJef.js} +1 -1
- package/dist/client/assets/AgentMasterScreen-DJPnstoD.js +1 -0
- package/dist/client/assets/{AgentSessions-CsZwoukw.js → AgentSessions-DCPCG4xb.js} +1 -1
- package/dist/client/assets/{AgentsConsole-KCao4XmX.js → AgentsConsole-CsYOoFJi.js} +1 -1
- package/dist/client/assets/{AgentsScreen-CtPAmwRX.js → AgentsScreen-k8LvBuU_.js} +1 -1
- package/dist/client/assets/AgentsSubnav-C4xpQhsv.js +1 -0
- package/dist/client/assets/{AstronautSuit-Ckx7lu7G.js → AstronautSuit-DbjQtfD_.js} +1 -1
- package/dist/client/assets/{AtopView-DYlpgEHf.js → AtopView-Daq_ob3z.js} +1 -1
- package/dist/client/assets/{BackToPicker-4JaeRvDm.js → BackToPicker-CXZjBRAe.js} +1 -1
- package/dist/client/assets/{BriefingDetailScreen-D6-xqrpo.js → BriefingDetailScreen-CUCXO-KH.js} +1 -1
- package/dist/client/assets/{BriefingsScreen-DKxSDEmk.js → BriefingsScreen-B5oMTGKv.js} +1 -1
- package/dist/client/assets/{BrokerMetadataPanel-BbREmsbK.js → BrokerMetadataPanel-BsiU8lTD.js} +1 -1
- package/dist/client/assets/{BrokerScreen-fbPIouMw.js → BrokerScreen-BPbOHhCS.js} +1 -1
- package/dist/client/assets/{CastPicker-BcA2vDDV.js → CastPicker-_5E5hNUe.js} +1 -1
- package/dist/client/assets/ChatCollapsedStrip-D-eXhzPf.js +1 -0
- package/dist/client/assets/{CodeDiffPane-Cn8Y9hAt.js → CodeDiffPane-n7W4iGUG.js} +1 -1
- package/dist/client/assets/{CodeProjectPicker-nPFktrco.js → CodeProjectPicker-CMsbSTDq.js} +1 -1
- package/dist/client/assets/{CodeScreen-BlAxtxE5.js → CodeScreen-CeuO3EhR.js} +1 -1
- package/dist/client/assets/{ConversationComposer-2HjbGPL9.js → ConversationComposer-CXPKx86g.js} +1 -1
- package/dist/client/assets/{ConversationFeedRows-C6wUqJrx.js → ConversationFeedRows-WrH-YI3L.js} +1 -1
- package/dist/client/assets/{ConversationHeader-C8vfXaTF.js → ConversationHeader-BQWzGzLK.js} +1 -1
- package/dist/client/assets/{ConversationPanels-CNCIbpqU.js → ConversationPanels-Dujvnmup.js} +2 -2
- package/dist/client/assets/ConversationScreen-CR9pWB65.js +2 -0
- package/dist/client/assets/{ConversationStatus-DZuyKsWN.js → ConversationStatus-DVzSb2Hv.js} +1 -1
- package/dist/client/assets/{CrewAvatar-CTIuxp4G.js → CrewAvatar-BwXjyg8N.js} +1 -1
- package/dist/client/assets/CrewWorkspaces-CkQDhyie.css +1 -0
- package/dist/client/assets/CrewWorkspaces-NKujRzwh.js +1 -0
- package/dist/client/assets/{DataTable-6IDhanr5.js → DataTable-Bp8tU9AK.js} +1 -1
- package/dist/client/assets/{DispatchAftermath-DC1u9itO.js → DispatchAftermath-B-6rmXzL.js} +1 -1
- package/dist/client/assets/{DocumentFocusViewer-DZVhS7as.js → DocumentFocusViewer-Do3wQ_3Z.js} +1 -1
- package/dist/client/assets/{EmbeddableSurfacesLab-BKUFJMCV.js → EmbeddableSurfacesLab-C1orRyP9.js} +1 -1
- package/dist/client/assets/{EmptyState-CeBl0iGd.js → EmptyState-CJzXj1l5.js} +1 -1
- package/dist/client/assets/{FileViewerPane-DQlpNt2S.js → FileViewerPane-Df6VzXjA.js} +1 -1
- package/dist/client/assets/FlightObserveScreen-6mGnmWQA.js +1 -0
- package/dist/client/assets/{FollowScreen-BXHOp3gb.js → FollowScreen-DvnxYLVh.js} +1 -1
- package/dist/client/assets/{HarnessMark-D5CA5uSp.js → HarnessMark-B979GCSB.js} +1 -1
- package/dist/client/assets/{HarnessesScreen-DhFXq1qz.js → HarnessesScreen-CHTuv8p6.js} +1 -1
- package/dist/client/assets/{HerdrSession-BRhs5LIR.js → HerdrSession-B3McuYgi.js} +1 -1
- package/dist/client/assets/{HomeHero-DMABJuze.js → HomeHero-CdUVPjkG.js} +1 -1
- package/dist/client/assets/{HostAdvisorView-RAociATV.js → HostAdvisorView-Bok5Sk5c.js} +1 -1
- package/dist/client/assets/{KnowledgeSearchInspector-CZPyVNSw.js → KnowledgeSearchInspector-B7XSoJsu.js} +1 -1
- package/dist/client/assets/{KnowledgeSearchScreen-mGTKIg00.js → KnowledgeSearchScreen-D3o3IODW.js} +1 -1
- package/dist/client/assets/{LaneToolHoverCard-D_DMlBeT.js → LaneToolHoverCard-HByf2ndx.js} +1 -1
- package/dist/client/assets/{LaneTraceDetailSheet-BEHg3LmH.js → LaneTraceDetailSheet-BUgHz-sd.js} +1 -1
- package/dist/client/assets/{LaneTraceEventFocus-DVimcizS.js → LaneTraceEventFocus-DM-hoPxG.js} +1 -1
- package/dist/client/assets/{MeshCanvas-BOuZx4AM.js → MeshCanvas-DCLJRsBy.js} +1 -1
- package/dist/client/assets/{MeshCanvasMinimap-wL-1N94e.js → MeshCanvasMinimap-cEFS9eW7.js} +1 -1
- package/dist/client/assets/{MeshScreen-DMY9Bmh5.js → MeshScreen-BcxPkhm6.js} +1 -1
- package/dist/client/assets/{MeshTopologyView-DiDcX5f4.js → MeshTopologyView-CCRPd8PU.js} +2 -2
- package/dist/client/assets/MessagesScreen-Bb5l13MO.js +1 -0
- package/dist/client/assets/{MissionContextRail-DrNKXG5u.js → MissionContextRail-DF0_kiU7.js} +1 -1
- package/dist/client/assets/{MissionControlView-ByBlHVN8.js → MissionControlView-E3V7bENU.js} +1 -1
- package/dist/client/assets/{MissionFocusOverlay-D1i6R6Zt.js → MissionFocusOverlay-h15sQFvP.js} +1 -1
- package/dist/client/assets/{MissionLeftAgentRow-DN9NcCML.js → MissionLeftAgentRow-KPdk9rSa.js} +1 -1
- package/dist/client/assets/{MissionLogPane-DSeIv3Xo.js → MissionLogPane-BbdDKjUl.js} +1 -1
- package/dist/client/assets/{NewAgentModal-V7yK6J6j.js → NewAgentModal-DfHxad34.js} +1 -1
- package/dist/client/assets/NewChatComposer-_Stj0fZy.js +19 -0
- package/dist/client/assets/{NewChatOrigin-DdpzE4kz.js → NewChatOrigin-B1u7ki70.js} +1 -1
- package/dist/client/assets/{ObserveEmbedScreen-l_Q3ts2q.js → ObserveEmbedScreen-Co0xTii6.js} +1 -1
- package/dist/client/assets/{ObserveTextFlow-BSEtYTxU.js → ObserveTextFlow-ZQWwrK3i.js} +2 -2
- package/dist/client/assets/{ObservedTopologyPanel-CdGUXxGR.js → ObservedTopologyPanel-BJUhDSuQ.js} +1 -1
- package/dist/client/assets/{OpenScoutAppShell-DN8dOSK4.js → OpenScoutAppShell-CUd2yOLu.js} +25 -25
- package/dist/client/assets/{OpsAgentsView-ntGr4pz4.js → OpsAgentsView-DI5wu1si.js} +1 -1
- package/dist/client/assets/OpsScreen-D8fQafCl.js +1 -0
- package/dist/client/assets/OpsSubnav-1K4Jaf__.js +1 -0
- package/dist/client/assets/ProjectAgentProfile-Bdjd_dAx.js +1 -0
- package/dist/client/assets/{ProjectAgentProfileBar-BQET-qrY.js → ProjectAgentProfileBar-k2QHHHsQ.js} +1 -1
- package/dist/client/assets/{ProjectAgentProfileHero-Ck8mThtx.js → ProjectAgentProfileHero-Bpxk1ui2.js} +1 -1
- package/dist/client/assets/ProjectsInbox-C_bMHLCc.js +2 -0
- package/dist/client/assets/ProjectsRail-J-aH_pxT.js +1 -0
- package/dist/client/assets/ProjectsScreen-cVUkGbPz.js +1 -0
- package/dist/client/assets/ProjectsThreadAside-_ourdM-Q.js +1 -0
- package/dist/client/assets/{Provider-B2xuo3rf.js → Provider-CtXJeLrP.js} +1 -1
- package/dist/client/assets/{RailRow-B-GycCBx.js → RailRow-CEH2MFBw.js} +1 -1
- package/dist/client/assets/{RawSessionsTable-AQThi6sm.js → RawSessionsTable-CDyrom-F.js} +1 -1
- package/dist/client/assets/RealtimeVoiceScreen-DBl3DN1H.js +1 -0
- package/dist/client/assets/{RepoDiffEmbedScreen-DXWoRF_c.js → RepoDiffEmbedScreen-kY2pHjIs.js} +1 -1
- package/dist/client/assets/{RepoDiffPageScreen-D_274ExO.js → RepoDiffPageScreen-C6LhoKrn.js} +1 -1
- package/dist/client/assets/{RepoDiffViewer-DbedmHDX.js → RepoDiffViewer-BhcIIQQg.js} +1 -1
- package/dist/client/assets/{RepoDiffViewerLazy-C0--fPtk.js → RepoDiffViewerLazy-Csy_j9LD.js} +2 -2
- package/dist/client/assets/{ReposScreen-D39_YG4H.js → ReposScreen-B_cB0zu7.js} +1 -1
- package/dist/client/assets/ScoutDeckSurface-CSy_fjcG.js +1 -0
- package/dist/client/assets/{ScoutSurface-UsRy0t-I.js → ScoutSurface-CQVcSrin.js} +1 -1
- package/dist/client/assets/{ScoutbotFxLab-Fmdfboxs.js → ScoutbotFxLab-DqGiLYNy.js} +1 -1
- package/dist/client/assets/{SecondaryNav-o2RL9H8H.js → SecondaryNav-BR4VRdgh.js} +1 -1
- package/dist/client/assets/SessionEmbedScreen-BTlZ9gAg.js +1 -0
- package/dist/client/assets/{SessionObserve-Dsd0j05N.js → SessionObserve-dQDN23pP.js} +1 -1
- package/dist/client/assets/{SessionObserveEvidence-DopQYDkD.js → SessionObserveEvidence-BRBGKAgd.js} +1 -1
- package/dist/client/assets/SessionRefScreen-COVQMbtE.js +1 -0
- package/dist/client/assets/SessionsScreen--5OJ3p3v.js +1 -0
- package/dist/client/assets/{SettingsDrawer-_AwuopMS.js → SettingsDrawer-RGVK_bmE.js} +1 -1
- package/dist/client/assets/{SettingsScreen-Cw4DDfJP.js → SettingsScreen-CCxzy5IU.js} +1 -1
- package/dist/client/assets/{ShikiPane-BfHc_3pM.js → ShikiPane-DYI9Hkge.js} +1 -1
- package/dist/client/assets/{SlidePanel-C-q7XwTa.js → SlidePanel-B9ugxWgA.js} +1 -1
- package/dist/client/assets/{SpriteAvatar-Bs68ZENy.js → SpriteAvatar-z5hHesx9.js} +1 -1
- package/dist/client/assets/{StatusPill-ZZQwxB1a.js → StatusPill-BFvMjmZV.js} +1 -1
- package/dist/client/assets/{TailView-Q4FVMsUH.js → TailView-0uEIj2JH.js} +1 -1
- package/dist/client/assets/{Terminal-D7zqHwHV.js → Terminal-DouZeNxc.js} +1 -1
- package/dist/client/assets/{TerminalEmbedScreen-CXIJ7qv6.js → TerminalEmbedScreen-dMNUbzXr.js} +1 -1
- package/dist/client/assets/{TerminalHeaderMount-BnBLOPbb.js → TerminalHeaderMount-BL07cd0q.js} +1 -1
- package/dist/client/assets/{TextDocumentSurface-CKQP-cBT.js → TextDocumentSurface-BflAwXeZ.js} +1 -1
- package/dist/client/assets/{TmuxPeek-V9dGESfO.js → TmuxPeek-BTnjOQi0.js} +1 -1
- package/dist/client/assets/{VoicePermissionsPanel-k7sbLXx2.js → VoicePermissionsPanel-CgQ6GGS-.js} +1 -1
- package/dist/client/assets/{WorkDetailScreen-60p9litn.js → WorkDetailScreen-CaLG-zDs.js} +1 -1
- package/dist/client/assets/{WorkFilesViewer-BjJS7GyM.js → WorkFilesViewer-B9Sil_No.js} +1 -1
- package/dist/client/assets/{activity-Bj3Hnbj3.js → activity-DcrMApUY.js} +1 -1
- package/dist/client/assets/{addon-fit-BL-NTWRU.js → addon-fit-DMVrz5Sv.js} +1 -1
- package/dist/client/assets/{addon-webgl-CIMgmNjg.js → addon-webgl-BYvpZUyu.js} +1 -1
- package/dist/client/assets/{agent-autocomplete-DXlvdc4b.js → agent-autocomplete-B-5QTeas.js} +1 -1
- package/dist/client/assets/{agent-essentials-BOMHR0_U.js → agent-essentials-D7KRGYvF.js} +1 -1
- package/dist/client/assets/{agent-lane-card-model-CTLxf3R4.js → agent-lane-card-model-CNZMPkhc.js} +1 -1
- package/dist/client/assets/{agent-lanes-model-AfrjRNK5.js → agent-lanes-model-DXqjs0OK.js} +2 -2
- package/dist/client/assets/agent-master-I1W-5d-x.css +1 -0
- package/dist/client/assets/agent-master-model-DqjrVI2h.js +1 -0
- package/dist/client/assets/{agent-specialization-BIPIBW8u.js → agent-specialization-BujJVUTD.js} +1 -1
- package/dist/client/assets/{arc.es-IR5r6sj_.js → arc.es-NHqHWohb.js} +1 -1
- package/dist/client/assets/{arrow-down-BydciYFZ.js → arrow-down-CKtSUjmW.js} +1 -1
- package/dist/client/assets/{arrow-left-CghA0kTw.js → arrow-left-Czpf-AE4.js} +1 -1
- package/dist/client/assets/{arrow-right-iJFv3jNh.js → arrow-right-BuzMnLYP.js} +1 -1
- package/dist/client/assets/{arrow-up-right-CCfZXPqD.js → arrow-up-right-C6Wl-1uw.js} +1 -1
- package/dist/client/assets/{bot-B5sub1-i.js → bot-rd0awxD3.js} +1 -1
- package/dist/client/assets/{check-C18YQC90.js → check-ofKUE8yH.js} +1 -1
- package/dist/client/assets/{chevron-down-Mp9mu_yd.js → chevron-down-wciXnOQz.js} +1 -1
- package/dist/client/assets/{chevron-right-CzH-TaSF.js → chevron-right-D-HdlPg8.js} +1 -1
- package/dist/client/assets/{chunk-HRAB3GC3-swV8PA2k.js → chunk-HRAB3GC3-Tyv9rzx7.js} +1 -1
- package/dist/client/assets/{chunk-JTPDIGGW-BKXqcLKw.js → chunk-JTPDIGGW-BC2Mandc.js} +3 -3
- package/dist/client/assets/{chunk-T65CQEWV-vYbNJ8E6.js → chunk-T65CQEWV-C1AWTYZZ.js} +1 -1
- package/dist/client/assets/{chunk-YOZR3KYS-U65yUmqt.js → chunk-YOZR3KYS-DwHPHa6f.js} +1 -1
- package/dist/client/assets/{clock-B4PTFi5m.js → clock-B88r8OrZ.js} +1 -1
- package/dist/client/assets/{code-xml-Jtxsp5d1.js → code-xml-D7pOQM9l.js} +1 -1
- package/dist/client/assets/{compass-0_54-vz3.js → compass-Dt1AMXz2.js} +1 -1
- package/dist/client/assets/content-9K38QchR.js +1 -0
- package/dist/client/assets/content-BRgnyXWh.js +1 -0
- package/dist/client/assets/{content-CHghn-rT.js → content-BWPNyXJ0.js} +1 -1
- package/dist/client/assets/content-BdkI07v3.js +1 -0
- package/dist/client/assets/content-C4oWa8SB.js +1 -0
- package/dist/client/assets/content-C9ijJxyl.js +1 -0
- package/dist/client/assets/content-CFZ4rghn.js +1 -0
- package/dist/client/assets/content-CIqu_Ci_.js +1 -0
- package/dist/client/assets/content-CnJF9DGO.js +1 -0
- package/dist/client/assets/content-CriW8Y8u.js +1 -0
- package/dist/client/assets/content-DDCyPPk_.js +1 -0
- package/dist/client/assets/content-DtcZeh5m.js +1 -0
- package/dist/client/assets/content-U9tsdtle.js +1 -0
- package/dist/client/assets/content-hFLK3CON.js +1 -0
- package/dist/client/assets/{content-DMbawvqU.js → content-nkx0swDe.js} +1 -1
- package/dist/client/assets/content-p00KQrtD.js +1 -0
- package/dist/client/assets/{conversation-icons-BV10B2Me.js → conversation-icons-tp9BX6X2.js} +1 -1
- package/dist/client/assets/{conversation-model-CwF6Y9gx.js → conversation-model-Dc02NsGp.js} +1 -1
- package/dist/client/assets/conversation-motion-features-D9-RmBSq.js +1 -0
- package/dist/client/assets/{copy-Dtpx4FOE.js → copy-CWWAJ75H.js} +1 -1
- package/dist/client/assets/{cpu-BjVis9mc.js → cpu-DrqejfkB.js} +1 -1
- package/dist/client/assets/{createLucideIcon-DXpqZP7I.js → createLucideIcon-DezKXSG2.js} +1 -1
- package/dist/client/assets/{ctx-panel-D_HJ3nhb.css → ctx-panel-F05jXK4Q.css} +1 -1
- package/dist/client/assets/discover-C2CZO4Tk.js +2 -0
- package/dist/client/assets/embed-entry-BSMUykuG.js +2 -0
- package/dist/client/assets/{external-link-Ckiyzjwo.js → external-link-Dp_a2vRZ.js} +1 -1
- package/dist/client/assets/{eye-CpfyvdLq.js → eye-BRyD0jno.js} +1 -1
- package/dist/client/assets/{file-code-corner-7mo7EviR.js → file-code-corner-muIVH_xO.js} +1 -1
- package/dist/client/assets/{file-text-KijGBnME.js → file-text-CqJgwxmv.js} +1 -1
- package/dist/client/assets/{gauge-y-Xg8Mrv.js → gauge-hU--hKVP.js} +1 -1
- package/dist/client/assets/{gestures-Bq9XnSqY.js → gestures-DN4hEeqv.js} +1 -1
- package/dist/client/assets/{git-branch-BQ_x8KZL.js → git-branch-CK5v8F2v.js} +1 -1
- package/dist/client/assets/{home-moving-signal-DtRpiNa0.js → home-moving-signal-BjDtEJUP.js} +1 -1
- package/dist/client/assets/{home-now-card-DFb4GOgM.js → home-now-card-nF8OotI-.js} +1 -1
- package/dist/client/assets/{home-now-card-nano-D--m9jpq.js → home-now-card-nano-C-r_bBg5.js} +1 -1
- package/dist/client/assets/{hooks-9d1SoaQA.js → hooks-D46bABUP.js} +1 -1
- package/dist/client/assets/index-CPrU5q04.js +1 -0
- package/dist/client/assets/{index-CZ-05hKz.js → index-DvLtl7rV.js} +5 -5
- package/dist/client/assets/index-kL1WLbeS.js +1 -0
- package/dist/client/assets/index-zvhpRHao.js +1 -0
- package/dist/client/assets/{inspector-panel-C-EhEDYy.js → inspector-panel-Dkc7rLvY.js} +1 -1
- package/dist/client/assets/{keyboard-nav-DFhAJkW3.js → keyboard-nav-BLYDhL3Z.js} +1 -1
- package/dist/client/assets/{lane-roster-store-gUBsydNf.js → lane-roster-store-DOdI1O13.js} +1 -1
- package/dist/client/assets/{layers-CGou-LwV.js → layers-CSsg3JVP.js} +1 -1
- package/dist/client/assets/{layout-grid-BrZt31QH.js → layout-grid-DOChPJdZ.js} +1 -1
- package/dist/client/assets/left-B-SdEJSJ.js +1 -0
- package/dist/client/assets/{left-B_o51JV6.js → left-B3wSE6ql.js} +1 -1
- package/dist/client/assets/{left-CwHZCGO3.js → left-BNRFiRsb.js} +1 -1
- package/dist/client/assets/{left-DA0amyfu.js → left-BggzhgXN.js} +1 -1
- package/dist/client/assets/left-CARCvvxS.js +2 -0
- package/dist/client/assets/left-CpokZYHt.js +1 -0
- package/dist/client/assets/{left-CwLs0okF.js → left-YT7mIGuH.js} +1 -1
- package/dist/client/assets/{left-advisor-DU3s01gk.js → left-advisor-CCY0vkcO.js} +1 -1
- package/dist/client/assets/left-agents-trhO5sL8.js +1 -0
- package/dist/client/assets/{left-default-uvuvDmt0.js → left-default-CG33elBs.js} +1 -1
- package/dist/client/assets/{left-lanes-DnNLgec8.js → left-lanes-CitMgeTp.js} +1 -1
- package/dist/client/assets/{left-mission-DN3-NLPC.js → left-mission-Zl2m_5eU.js} +1 -1
- package/dist/client/assets/{library-DIo5NiGP.js → library-DkALuCh5.js} +1 -1
- package/dist/client/assets/{loader-circle-BiohlpM3.js → loader-circle-pM56HNhR.js} +1 -1
- package/dist/client/assets/{local-agents-wUIaBcEr.js → local-agents-C8xAhbO5.js} +1 -1
- package/dist/client/assets/{mentions-CcPFMbmZ.js → mentions-DG6OQrsc.js} +1 -1
- package/dist/client/assets/{mesh-buckets-ByyFXdKT.js → mesh-buckets-6y3ZIibI.js} +1 -1
- package/dist/client/assets/{mesh-ops-CvGyjK84.js → mesh-ops-BZ1h5RQs.js} +1 -1
- package/dist/client/assets/{mesh-roster-n2nDpEmA.js → mesh-roster-Bc7T4b7z.js} +1 -1
- package/dist/client/assets/{mesh-view-store-BpxGm71b.js → mesh-view-store-ChUOASK8.js} +1 -1
- package/dist/client/assets/{message-circle-B2ddzBrX.js → message-circle-mZCv8tvB.js} +1 -1
- package/dist/client/assets/{message-markup-RkfmDfME.js → message-markup-C2LQDm_k.js} +1 -1
- package/dist/client/assets/{message-square-D9YYWE0x.js → message-square-C7t_qtuj.js} +1 -1
- package/dist/client/assets/{message-visibility-DwxgcgYK.js → message-visibility-CGOmSSKs.js} +1 -1
- package/dist/client/assets/{mission-control-store-Bf4b54MV.js → mission-control-store-nDLdUZPA.js} +1 -1
- package/dist/client/assets/{observe-CJRIvOCn.js → observe-BpEm1INu.js} +1 -1
- package/dist/client/assets/{page-status-BptpTdQ-.js → page-status-E5jnk48p.js} +1 -1
- package/dist/client/assets/{paperclip-B1UNGl5d.js → paperclip-C64lkcbM.js} +1 -1
- package/dist/client/assets/{persistent-state-YI-WHSCF.js → persistent-state-EHXw8WNy.js} +1 -1
- package/dist/client/assets/{plus-CuU_X0-8.js → plus-Co-dqKul.js} +1 -1
- package/dist/client/assets/{profile-rY8jO38P.js → profile-APxDsN2P.js} +1 -1
- package/dist/client/assets/projects-inbox-Cg4X2lUQ.js +1 -0
- package/dist/client/assets/projects-inbox-DRBl2N85.css +1 -0
- package/dist/client/assets/{proxy-DnLpZIi9.js → proxy-BiW5suC7.js} +1 -1
- package/dist/client/assets/{radio-Dm1ItnA4.js → radio-BOxBQX-T.js} +1 -1
- package/dist/client/assets/{refresh-cw-BRn9Oxxl.js → refresh-cw-DMxGzDwn.js} +1 -1
- package/dist/client/assets/resolve-panes-DeVJbS9c.js +1 -0
- package/dist/client/assets/resolve-sidebar-context-BQe5J6xF.js +1 -0
- package/dist/client/assets/{right-BJltPRnd.js → right-Bmfd3pjP.js} +1 -1
- package/dist/client/assets/{right-Beh3nCUB.js → right-BqI-nr9G.js} +1 -1
- package/dist/client/assets/{right-D3aTKf1F.js → right-BuCgE0fZ.js} +1 -1
- package/dist/client/assets/{right-Shpw_xDy.js → right-BwlW6E57.js} +1 -1
- package/dist/client/assets/{right-CPP7GyOm.js → right-C0ybUw0j.js} +1 -1
- package/dist/client/assets/{right-BbyYdzHn.js → right-CdkcrmeD.js} +1 -1
- package/dist/client/assets/{right-CJnB_Bg7.js → right-CimaAvQN.js} +1 -1
- package/dist/client/assets/{right-C1yumXNx.js → right-CkCCPbCX.js} +1 -1
- package/dist/client/assets/{right-DI1B79nR.js → right-D3eSiy41.js} +1 -1
- package/dist/client/assets/{right-DtsRNX5b.js → right-Dz_xD0Vj.js} +1 -1
- package/dist/client/assets/{rocket-DOwXHKWA.js → rocket-BQm5_CvR.js} +1 -1
- package/dist/client/assets/router-B9vQkNJL.js +1 -0
- package/dist/client/assets/{scope-views-A4_vP97W.js → scope-views-1IYJdl41.js} +1 -1
- package/dist/client/assets/{scout-voice-BhPzrc6P.js → scout-voice-BVUqGhth.js} +1 -1
- package/dist/client/assets/{scoutbot-markdown-jh7tzFB1.js → scoutbot-markdown-BQ_Ee2Ic.js} +1 -1
- package/dist/client/assets/{scroll-text-DO0GQzvN.js → scroll-text-Dze_dXtQ.js} +1 -1
- package/dist/client/assets/{search-D1tJSAWe.js → search-CDko0PKE.js} +1 -1
- package/dist/client/assets/{secondaryNavConfig-B9IF8wXl.js → secondaryNavConfig-BoQ_zYR9.js} +1 -1
- package/dist/client/assets/{selection-bridge-i2S9zpf8.js → selection-bridge-Din6yV3h.js} +1 -1
- package/dist/client/assets/{send-horizontal-CgLppsIC.js → send-horizontal-CSjIm6xg.js} +1 -1
- package/dist/client/assets/{server-Dymv5Emh.js → server-Bzj7lPIx.js} +1 -1
- package/dist/client/assets/{session-catalog-DNaOEzoQ.js → session-catalog-DsaZJXZt.js} +1 -1
- package/dist/client/assets/session-ref-lookup-state-SATH_jAP.js +1 -0
- package/dist/client/assets/{session-table-PTQVoTyc.js → session-table-BQfR7u6r.js} +1 -1
- package/dist/client/assets/{settings-2fC_G9nX.js → settings-Dyvpkb1D.js} +1 -1
- package/dist/client/assets/{sliders-horizontal-BPSMHhbm.js → sliders-horizontal-C8njVwfg.js} +1 -1
- package/dist/client/assets/{sparkles-Dy8p5xN8.js → sparkles-CETYrxGA.js} +1 -1
- package/dist/client/assets/{sse-CiOSzE5n.js → sse-CD9MMUxl.js} +1 -1
- package/dist/client/assets/{tail-events-BMQmSx1n.js → tail-events-Ps8KpKah.js} +1 -1
- package/dist/client/assets/{terminal-yN9xN-h9.js → terminal-9GRS_Qdc.js} +1 -1
- package/dist/client/assets/{terminal-relay-9lhzEp2V.js → terminal-relay-GYMIvKs1.js} +1 -1
- package/dist/client/assets/{terminal-takeover-DANQfTcy.js → terminal-takeover-_Jyys4me.js} +1 -1
- package/dist/client/assets/{text-CnZ0e1-V.js → text-BP3oyl8-.js} +1 -1
- package/dist/client/assets/{text-rLpBg4_z.css → text-BYAFNLNq.css} +1 -1
- package/dist/client/assets/{use-conversation-list-D9BNLfnW.js → use-conversation-list-C9ABzjXI.js} +1 -1
- package/dist/client/assets/use-fleet-active-asks-DAspZQjE.js +1 -0
- package/dist/client/assets/{use-mesh-ops-items-BIvIHlqe.js → use-mesh-ops-items-Dh54ymEp.js} +1 -1
- package/dist/client/assets/{use-reduced-motion-CKkhq9c5.js → use-reduced-motion-x8pJMVrG.js} +1 -1
- package/dist/client/assets/{use-scout-dev-flags-B2KCzPxn.js → use-scout-dev-flags-DhCbiDK3.js} +1 -1
- package/dist/client/assets/{useAgentHoverCard-CHBsxcbp.js → useAgentHoverCard-DoBwV0LX.js} +1 -1
- package/dist/client/assets/useContentSecondaryNav-pZe2Zfk1.js +1 -0
- package/dist/client/assets/{usePierreRuntime-DUuXH5yp.js → usePierreRuntime-ejq9dCWV.js} +1 -1
- package/dist/client/assets/{wrench-YcXMlsh2.js → wrench-DjkoAOQt.js} +1 -1
- package/dist/client/assets/{x-e3h2hDsp.js → x-CAbNespN.js} +1 -1
- package/dist/client/assets/{xterm-Byp1Hep_.js → xterm-Cf-ngcGP.js} +1 -1
- package/dist/client/assets/{zap-nMcjPoWB.js → zap-Cq8eWkcF.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/drizzle/0009_old_korg.sql +72 -0
- package/dist/drizzle/0010_sparkling_colonel_america.sql +2 -0
- package/dist/drizzle/0011_funny_onslaught.sql +4 -0
- package/dist/drizzle/0012_high_blazing_skull.sql +16 -0
- package/dist/drizzle/0013_perfect_juggernaut.sql +1 -0
- package/dist/drizzle/0014_legal_meggan.sql +6 -0
- package/dist/drizzle/0015_lame_marvel_boy.sql +12 -0
- package/dist/drizzle/0016_early_goliath.sql +6 -0
- package/dist/drizzle/meta/0009_snapshot.json +6262 -0
- package/dist/drizzle/meta/0010_snapshot.json +6286 -0
- package/dist/drizzle/meta/0011_snapshot.json +6337 -0
- package/dist/drizzle/meta/0012_snapshot.json +6458 -0
- package/dist/drizzle/meta/0013_snapshot.json +6465 -0
- package/dist/drizzle/meta/0014_snapshot.json +6503 -0
- package/dist/drizzle/meta/0015_snapshot.json +6596 -0
- package/dist/drizzle/meta/0016_snapshot.json +6611 -0
- package/dist/drizzle/meta/_journal.json +56 -0
- package/dist/main.mjs +1306 -360
- package/dist/node/main.mjs +314 -12
- package/dist/pairing-runtime-controller.mjs +608 -108
- package/dist/runtime/base-daemon.mjs +30 -3
- package/dist/runtime/broker-daemon.mjs +4771 -529
- package/dist/runtime/broker-process-manager.mjs +23 -2
- package/dist/runtime/mesh-discover.mjs +23 -2
- package/dist/scout-control-plane-web.mjs +1914 -478
- package/package.json +2 -2
- package/dist/client/assets/AgentLanesEmbedScreen-BmLnN4on.js +0 -1
- package/dist/client/assets/AgentLanesPreflight-5B6sXvRB.js +0 -1
- package/dist/client/assets/AgentLanesView-DHyzVBk6.js +0 -2
- package/dist/client/assets/AgentsSubnav-CDMjKeYC.js +0 -1
- package/dist/client/assets/ChatCollapsedStrip-Ycm0ecaX.js +0 -1
- package/dist/client/assets/ConversationScreen-BNULZAp2.js +0 -2
- package/dist/client/assets/CrewWorkspaces-CJhBKVoZ.css +0 -1
- package/dist/client/assets/CrewWorkspaces-CkPYIA46.js +0 -1
- package/dist/client/assets/FlightObserveScreen-CDWGSKZg.js +0 -1
- package/dist/client/assets/MessagesScreen-Eulveud3.js +0 -1
- package/dist/client/assets/NewChatComposer-hlWT-nbR.js +0 -19
- package/dist/client/assets/OpsScreen-Ppen_Lmj.js +0 -1
- package/dist/client/assets/OpsSubnav-GAKsoSor.js +0 -1
- package/dist/client/assets/ProjectAgentProfile-BLlp2e6t.js +0 -1
- package/dist/client/assets/ProjectsInbox-Dlt8OQ8O.js +0 -2
- package/dist/client/assets/ProjectsRail-DCfNMmnW.js +0 -1
- package/dist/client/assets/ProjectsScreen-BP-hmI1m.js +0 -1
- package/dist/client/assets/ProjectsThreadAside-CWpMjGIH.js +0 -1
- package/dist/client/assets/RealtimeVoiceScreen-D7zZHK_t.js +0 -1
- package/dist/client/assets/ScoutDeckSurface-CKT3qdqY.js +0 -1
- package/dist/client/assets/SessionEmbedScreen-RD5XOx7R.js +0 -1
- package/dist/client/assets/SessionRefScreen-B_cTv47v.js +0 -1
- package/dist/client/assets/SessionsScreen-Bq0Z77On.js +0 -1
- package/dist/client/assets/archive-BjcGiAy8.js +0 -1
- package/dist/client/assets/content-6RvWTrtk.js +0 -1
- package/dist/client/assets/content-BCgwMUqz.js +0 -1
- package/dist/client/assets/content-Bf2VLhx0.js +0 -1
- package/dist/client/assets/content-BrU_38-m.js +0 -1
- package/dist/client/assets/content-BvvJN8rN.js +0 -1
- package/dist/client/assets/content-CAeEqYPw.js +0 -1
- package/dist/client/assets/content-CI_Z9DXk.js +0 -1
- package/dist/client/assets/content-CbyKONhW.js +0 -1
- package/dist/client/assets/content-Czogvp43.js +0 -1
- package/dist/client/assets/content-DFk0zNzX.js +0 -1
- package/dist/client/assets/content-DHe4DgkA.js +0 -1
- package/dist/client/assets/content-DTz7cKjo.js +0 -1
- package/dist/client/assets/content-E3kudY-W.js +0 -1
- package/dist/client/assets/content-LpO0aO_U.js +0 -1
- package/dist/client/assets/conversation-motion-features-BKkCRaWR.js +0 -1
- package/dist/client/assets/discover-CHbrEItO.js +0 -2
- package/dist/client/assets/embed-entry-vil28MyU.js +0 -2
- package/dist/client/assets/index-BVlMw8x_.js +0 -1
- package/dist/client/assets/index-Cn0GR-q1.js +0 -1
- package/dist/client/assets/index-DosI4AG9.js +0 -1
- package/dist/client/assets/left-BpgWnaah.js +0 -1
- package/dist/client/assets/left-Cx0kv6pe.js +0 -1
- package/dist/client/assets/left-agents-qL5PpUY-.js +0 -1
- package/dist/client/assets/left-z-6CkuBe.js +0 -2
- package/dist/client/assets/projects-inbox-BBs1hG13.css +0 -1
- package/dist/client/assets/projects-inbox-D-zAb9Gp.js +0 -1
- package/dist/client/assets/resolve-panes-DO6LkwhQ.js +0 -1
- package/dist/client/assets/resolve-sidebar-context-CIF288wY.js +0 -1
- package/dist/client/assets/router-DJj2WbDg.js +0 -1
- package/dist/client/assets/use-fleet-active-asks-BeAdcl09.js +0 -1
- package/dist/client/assets/useContentSecondaryNav-D0mUhxTF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as e}from"./index-CZ-05hKz.js";import{H as L,h as pe}from"./HarnessMark-D5CA5uSp.js";import{p as me,a as Z}from"./api-Co9aQ2Jw.js";import{b as fe}from"./router-DJj2WbDg.js";import{n as S,t as J,f as O}from"./time-Dhsh_2EG.js";import{u as ge}from"./Provider-B2xuo3rf.js";import{u as xe}from"./useContentSecondaryNav-D0mUhxTF.js";import{OpsSubnav as be}from"./OpsSubnav-GAKsoSor.js";/* empty css */import{R as ve}from"./refresh-cw-BRn9Oxxl.js";import{E as Y}from"./external-link-Ckiyzjwo.js";import{c as je}from"./createLucideIcon-DXpqZP7I.js";import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CiOSzE5n.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-DZVhS7as.js";import"./TextDocumentSurface-CKQP-cBT.js";import"./file-text-KijGBnME.js";import"./x-e3h2hDsp.js";import"./chevron-right-CzH-TaSF.js";import"./code-xml-Jtxsp5d1.js";import"./arrow-left-CghA0kTw.js";import"./arrow-right-iJFv3jNh.js";import"./scout-voice-BhPzrc6P.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-DFhAJkW3.js";import"./NewChatComposer-hlWT-nbR.js";import"./text-CnZ0e1-V.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-BiohlpM3.js";import"./conversation-model-CwF6Y9gx.js";import"./index-BVlMw8x_.js";import"./NewChatOrigin-DdpzE4kz.js";import"./chevron-down-Mp9mu_yd.js";import"./search-D1tJSAWe.js";import"./chunk-HRAB3GC3-swV8PA2k.js";import"./SecondaryNav-o2RL9H8H.js";import"./secondaryNavConfig-B9IF8wXl.js";import"./message-square-D9YYWE0x.js";import"./compass-0_54-vz3.js";import"./settings-2fC_G9nX.js";import"./terminal-yN9xN-h9.js";import"./git-branch-BQ_x8KZL.js";import"./scroll-text-DO0GQzvN.js";/* empty css */const D=60*6e4,N=24*D,ke=["product_judgment","large_context_synthesis","adversarial_critique","evidence_inventory","implementation","code_review"],V={fable:j("Fable 5","claude","claude","claude-fable-5","max","Fable","Premium product taste, rapid design iterations, and premise-level critique.","Uses the premium shared Claude allowance; do not spend it on routine mechanical work."),sol:j("GPT-5.6 Sol","codex","codex","gpt-5.6-sol","xhigh",null,"Load-bearing coding, debugging, integration, and technically grounded judgment.","Highest Codex tier; reserve deep turns for work where failure is expensive."),grok:j("Grok 4.6","grok","grok","grok-4.6",null,"Grok","Independent assumption checking, deletion pressure, and adversarial critique.","Do not make it the sole implementation authority; verify conclusions against repository evidence."),kimi:j("Kimi Code","kimi","kimi",null,null,"Kimi","Dense repository and study synthesis through the native Kimi harness.","The harness owns the concrete model and quota telemetry can be stale; probe before large fan-out."),opus:j("Opus 5","claude","claude","claude-opus-5","high","Opus","Long-context synthesis, nuanced architecture, and coherent product reasoning.","Premium shared Claude quota; avoid routine scans and repetitive verification."),glm:j("GLM-5.2","opencode","opencode","opencode-go/glm-5.2",null,"OpenCode","Independent broad-context synthesis through OpenCode.","OpenCode quota is not visible in Scout; use a bounded canary before scaling."),terra:j("GPT-5.6 Terra","codex","codex","gpt-5.6-terra","high",null,"Balanced implementation, correctness review, and technical critique.","Prefer Sol for the hardest integration boundary when its additional spend is justified."),minimax:j("MiniMax M3","minimax","opencode","opencode-go/minimax-m3",null,"OpenCode","Cost-effective structured evidence collection and comparison.","Verify load-bearing conclusions with a stronger reviewer before acceptance."),luna:j("GPT-5.6 Luna","codex","codex","gpt-5.6-luna","medium",null,"Inexpensive source mapping, test enumeration, and mechanical audit work.","Keep it out of sole high-stakes product judgment and final acceptance."),haiku:j("Haiku 4.5","claude","claude","claude-haiku-4-5","low",null,"Fast narrow scans and classification inside the Claude harness.","Lighter reasoning and a smaller context window make broad synthesis a poor fit."),sonnet:j("Sonnet 4.6","claude","claude","claude-sonnet-4-6","high",null,"Strong generalist implementation with a large context window.","Shares Claude's provider allowance and can become a poor choice when that pool is guarded."),deepseek:j("DeepSeek V4 Pro","opencode","opencode","opencode-go/deepseek-v4-pro",null,"OpenCode","Code-centric review through an independent model lineage.","Quota is opaque and findings should not be the sole acceptance authority.")},ee={product_judgment:{label:"Product judgment",objective:"Strategic tradeoffs, UX prioritization, scope shaping, and high-level product decisions.",strategy:"Select models with high nuanced taste, product-level synthesis, and clear communication of architectural tradeoffs.",candidates:[b("fable",100,"Unmatched product taste, rapid design iteration synthesis, and high-fidelity UX direction."),b("sol",87,"Technically grounded product decisions with strong execution realism."),b("grok",82,"Unfiltered perspective on feature bloat and aggressive scope reduction.")]},large_context_synthesis:{label:"Large-context synthesis",objective:"Repository-wide investigations, deep architectural archaeology, and multi-file code synthesis.",strategy:"Select models with expansive effective context windows and high-density information compression.",candidates:[b("kimi",100,"Native long-context retrieval and dense codebase relationship synthesis."),b("opus",91,"Deep structural understanding across complex multi-package repositories."),b("glm",84,"Independent wide-window scanning and structural cross-referencing.")]},adversarial_critique:{label:"Adversarial critique",objective:"Challenging design assumptions, rapid design iteration critique, identifying UX/logic gaps, and applying deletion pressure.",strategy:"Select high-taste and contrarian model lineages that stress-test design iterations and probe corner cases without sycophantic approval.",candidates:[b("fable",100,"High-fidelity design critique, rapid UX/visual iteration stress-testing, and premise challenge."),b("grok",91,"Contrarian perspective, uncompromising edge-case discovery, and aggressive premise challenge."),b("terra",84,"Rigorous technical inspection of code correctness and runtime invariants.")]},evidence_inventory:{label:"Evidence inventory",objective:"Grep and AST inventory, reference tracing, log audit, and structured fact collection.",strategy:"Select fast, cost-effective models with high precision on structured evidence gathering.",candidates:[b("minimax",100,"Fast, cost-effective structured evidence indexing and pattern enumeration."),b("luna",95,"Low-latency source tracing, test inventory, and reference mapping."),b("haiku",87,"Rapid mechanical file scans and categorization.")]},implementation:{label:"Implementation",objective:"Code creation, refactoring, type checking, unit test writing, and bug fixing.",strategy:"Select code-generation champions with high instruction following and strong language typing skills.",candidates:[b("sol",100,"Deep technical accuracy, robust multi-file refactors, and complex logic execution."),b("terra",91,"Reliable structured implementation with strong type-system adherence."),b("sonnet",87,"Strong generalist coding with fast turn times and clear explanations.")]},code_review:{label:"Code review",objective:"Diff analysis, security audit, regression detection, and style conformity.",strategy:"Select models with high sensitivity to subtle bugs, invariant violations, and edge-case behaviors.",candidates:[b("terra",100,"Strict invariant checking, subtle logic flaw detection, and boundary test coverage."),b("opus",96,"High-level architectural consistency and API surface evolution review."),b("deepseek",87,"Independent second-opinion review focused on code-level edge cases.")]}};function $(s){return s.availability==="constrained"||s.availability==="guarded"||s.minimumRemainingPercent!==null&&s.minimumRemainingPercent<=20||s.pacing==="ahead"&&(s.minimumRemainingPercent??100)<=35}function se(s){return s.confidence==="fresh"&&s.minimumRemainingPercent!==null&&!$(s)}function ye(s){return $(s)?s.minimumRemainingPercent!==null&&s.minimumRemainingPercent<=15?`${s.providerLabel} is near capacity (${s.minimumRemainingPercent}% remaining). High risk of quota exhaustion.`:s.pacing==="ahead"?`${s.providerLabel} consumption rate exceeds window pace with limited buffer.`:`${s.providerLabel} quota availability is ${s.availability}. Failover recommended.`:null}function k(s){return[s.providerId,s.harness,s.model,s.effort,s.profile].join("|")}function Ne(s){return[s.profile?`profile ${s.profile}`:s.harness,s.model,s.effort].filter(Boolean).join(" / ")}function Re(s,n="<request>"){const a=s.profile?.trim().toLowerCase()??null,t=a!=="opencode"&&a!=="oc",i=s.profile&&t?["--profile",s.profile]:["--harness",s.harness,...s.model?["--model",s.model]:[]];return s.effort&&i.push("--effort",s.effort),i.push(n),i}function B(s,n="<request>"){return["scout","ask",...Re(s,n)].map(_e).join(" ")}function we(s,n={}){const a=ne(n.now)??Date.now(),t=n.bias??"balanced",i=Me(t),o=new Map(s.providers.map(h=>[h.id,qe(h,a)])),r=n.role?[n.role]:[...ke],c=r.map(h=>{const u=ee[h],d=u.candidates.map(f=>{const g=o.get(f.route.providerId)??ae(f.route.providerId);return{runtime:f,quota:g,score:f.fit+Ae(g,a)*i}}).sort((f,g)=>g.score-f.score||g.runtime.fit-f.runtime.fit),p=d[0],x=$(p.quota),v=d.slice(1);return x&&v.sort((f,g)=>{const q=K(f,p.runtime.route.providerId),T=K(g,p.runtime.route.providerId);return q-T||g.score-f.score||g.runtime.fit-f.runtime.fit}),{role:h,roleLabel:u.label,modelLabel:p.runtime.label,route:p.runtime.route,score:p.score,fit:p.runtime.fit,objective:u.objective,taskRationale:p.runtime.taskRationale,capability:p.runtime.capability,caution:p.runtime.caution,assertion:Le(p.quota),quotaRisk:x,quotaRiskMessage:ye(p.quota),quota:p.quota,alternatives:v.slice(0,2).map(({runtime:f,quota:g,score:q})=>({label:f.label,route:f.route,score:q,fit:f.fit,capability:f.capability,caution:f.caution,taskRationale:f.taskRationale,quotaRisk:$(g),quota:g}))}}),l=Se(r,o,a);return{generatedAt:s.generatedAt,generatedAtLocal:s.generatedAtLocal,evaluatedAt:a,assignments:c,models:l,bias:t}}function Se(s,n,a){const t=new Map;for(const i of s){const o=ee[i];for(const r of o.candidates){const c=k(r.route),l=t.get(c);l?l.roles.push({role:i,label:o.label}):t.set(c,{runtime:r,roles:[{role:i,label:o.label}]})}}return[...t.values()].map(({runtime:i,roles:o})=>{const r=n.get(i.route.providerId)??ae(i.route.providerId);return{modelLabel:i.label,route:i.route,roles:o,strengths:[i.capability],cautions:[i.caution],guidance:Ce(r,a),quotaRisk:$(r),quota:r}})}function qe(s,n){const a=s.windows.filter(h=>!/^video\b/iu.test(h.label)).map(h=>$e(h,n)),t=[...a].sort((h,u)=>h.percentRemaining-u.percentRemaining)[0]??null,i=a.filter(h=>h.paceRatio!==null).sort((h,u)=>u.paceRatio-h.paceRatio)[0]??null,o=a.map(h=>h.confidence),r=o.includes("stale")?"stale":o.includes("fresh")?"fresh":"unknown",c=[...a].filter(h=>h.resetAt!==null&&h.resetAt>n).sort((h,u)=>h.resetAt-u.resetAt)[0]??null,l=t?.percentRemaining??null;return{providerId:s.id,providerLabel:s.label,plan:s.plan,availability:Te(l),pacing:i?.status??"unknown",confidence:r,minimumRemainingPercent:l,bindingWindow:t?.label??null,nextResetAt:c?.resetAt??null,nextResetIn:c?.resetIn??"",windows:a}}function $e(s,n){const a=ne(s.windowMs)??Pe(s.label,s.resetAt),t=a!==null&&s.resetAt!==null?X(Ue(100-(s.resetAt-n)/a*100,0,100)):null,i=t!==null&&t>=1?De(s.usedPercent/t):null,o=i===null?null:X(i*100),r=Ie(s.usedPercent,t,i),c=a===null?N:Math.min(N,Math.max(D,a/4)),l=s.freshness.ageMs===null?"unknown":s.freshness.ageMs>c?"stale":"fresh";return{label:s.label,usedPercent:s.usedPercent,percentRemaining:s.percentRemaining,durationMs:a,elapsedPercent:t,paceRatio:i,projectedUsedPercent:o,status:r,resetAt:s.resetAt,resetIn:s.resetIn,freshness:s.freshness.label,confidence:l}}function j(s,n,a,t,i,o,r,c){return{label:s,route:{providerId:n,harness:a,model:t,effort:i,profile:o},capability:r,caution:c}}function b(s,n,a){return{...V[s],fit:n,taskRationale:a??V[s].capability}}function Ce(s,n){return $(s)?"conserve":s.confidence!=="fresh"?"probe_first":s.availability==="constrained"?"conserve":s.nextResetAt!==null&&s.nextResetAt>n&&s.nextResetAt-n<=N&&s.pacing!=="ahead"&&(s.minimumRemainingPercent??0)>=10?"use_now":s.availability==="guarded"?"conserve":s.pacing==="ahead"?"use_deliberately":s.availability==="abundant"&&s.pacing==="underused"?"use_now":"available"}function Me(s){switch(s){case"capability":return .25;case"quota":return 1.75;case"balanced":return 1}}function Ae(s,n){let a=0;switch(s.availability){case"abundant":a+=10;break;case"available":a+=5;break;case"guarded":a-=5;break;case"constrained":a-=30;break;case"unknown":a-=2;break}return s.pacing==="underused"&&(a+=5),s.pacing==="ahead"&&(a-=8),s.confidence==="stale"&&(a-=8),s.confidence==="unknown"&&(a-=3),s.pacing==="underused"&&s.nextResetAt!==null&&s.nextResetAt>n&&s.nextResetAt-n<=2*N&&(a+=3),a}function Le(s){if(s.minimumRemainingPercent===null)return`${te(s.providerId)} quota telemetry unavailable; use a bounded canary before scaling.`;const n=s.pacing==="on_track"?"usage tracks elapsed time":s.pacing==="underused"?"usage trails elapsed time":s.pacing==="ahead"?"usage exceeds elapsed time":"pace unknown",a=s.nextResetIn?` · next reset ${s.nextResetIn}`:"";return`${Oe(s.minimumRemainingPercent)} minimum remaining · ${n} · telemetry ${s.confidence}${a}.`}function ae(s){return{providerId:s,providerLabel:te(s),plan:null,availability:"unknown",pacing:"unknown",confidence:"unknown",minimumRemainingPercent:null,bindingWindow:null,nextResetAt:null,nextResetIn:"",windows:[]}}function Pe(s,n){const a=s.trim().toLowerCase(),t=a.match(/(?:^|\s)(\d+(?:\.\d+)?)([hd])$/u);if(t){const i=Number(t[1]);return t[2]==="h"?i*D:i*N}if(a==="weekly"||a==="week"||a==="7-day")return 7*N;if(a==="5-hour")return 5*D;if(a==="monthly"||a==="month"){if(n===null)return 30*N;const i=new Date(n),o=new Date(n);o.setUTCMonth(o.getUTCMonth()-1);const r=i.getTime()-o.getTime();return r>0?r:30*N}return null}function Ie(s,n,a){if(n===null||a===null)return"unknown";const t=s-n;return a>1.1&&t>3?"ahead":a<.7&&t<-10?"underused":"on_track"}function Te(s){return s===null?"unknown":s>=60?"abundant":s>=30?"available":s>=15?"guarded":"constrained"}function K(s,n){const a=se(s.quota),t=s.runtime.route.providerId!==n;return a&&t?0:a?1:t?2:3}function _e(s){return/^[A-Za-z0-9_./:@%+=,-]+$/u.test(s)?s:`'${s.replaceAll("'",`'"'"'`)}'`}function te(s){return s.split(/[-_\s]+/u).filter(Boolean).map(n=>`${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ")||"Unknown"}function Oe(s){return`${Number.isInteger(s)?s.toFixed(0):s.toFixed(1)}%`}function ne(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function X(s){return Math.round(s*10)/10}function De(s){return Math.round(s*100)/100}function Ue(s,n,a){return Math.min(a,Math.max(n,s))}const Ee=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Fe=je("clipboard-paste",Ee),Ge=3e4,M=[{value:"capability",label:"Capability"},{value:"balanced",label:"Balanced"},{value:"quota",label:"Quota"}],Be={codex:"Codex",claude:"Claude",kimi:"Kimi",minimax:"MiniMax",cursor:"Cursor",native:"Native",worker:"Worker",bridge:"Bridge",http:"HTTP",pi:"Pi",flue:"Flue",github:"GitHub",unknown:"Unknown"},ie=[{id:"claude",description:"Anthropic plan windows captured from Claude Code.",links:[{label:"Usage",href:"https://claude.ai/settings/usage"},{label:"Manage plan",href:"https://claude.ai/settings/billing"}]},{id:"codex",description:"OpenAI plan windows reported by local Codex sessions.",links:[{label:"Usage",href:"https://chatgpt.com/codex/settings/usage"},{label:"Open Codex",href:"https://chatgpt.com/codex"}]},{id:"kimi",description:"Kimi Code subscription windows and membership level.",links:[{label:"Kimi Code",href:"https://www.kimi.com/code"},{label:"Docs",href:"https://www.kimi.com/code/docs/en/"}]},{id:"grok",description:"SuperGrok quota reported by local Grok, with dashboard capture and local activity as fallbacks.",links:[{label:"Open Grok",href:"https://grok.com/"},{label:"Billing",href:"https://grok.com/?_s=billing"},{label:"Help",href:"https://docs.x.ai/grok/faq"}]},{id:"minimax",description:"MiniMax Token Plan 5-hour and weekly allowance.",links:[{label:"Usage",href:"https://platform.minimax.io/console/plan"},{label:"Docs",href:"https://platform.minimax.io/docs/token-plan/intro"}]},{id:"cursor",description:"Cursor membership detected locally, plus usage totals from an exported dashboard capture.",links:[{label:"Usage",href:"https://cursor.com/dashboard/usage"},{label:"Manage plan",href:"https://cursor.com/dashboard/billing"}]}],He={cloudflare:[{label:"Dashboard",href:"https://dash.cloudflare.com/"},{label:"Billing",href:"https://dash.cloudflare.com/?to=/:account/billing"}],vercel:[{label:"Dashboard",href:"https://vercel.com/dashboard"},{label:"Billing",href:"https://vercel.com/account/billing"}],exe:[{label:"VMs",href:"https://exe.dev/"},{label:"Billing",href:"https://exe.dev/user/billing"},{label:"Docs",href:"https://exe.dev/docs/what-is-exe"}]},ze={exe:{category:"Agent compute",description:"Persistent VMs for remote Scout agents and isolated workloads."},cloudflare:{category:"Edge platform",description:"Workers, networking, and edge infrastructure available for deployment."},vercel:{category:"App hosting",description:"Projects, preview environments, and production deployments."}};function Qe({provider:s}){return e.jsx("span",{className:`hs-cloud-mark hs-cloud-mark--${s}`,"aria-hidden":"true",children:s==="exe"?e.jsx("img",{src:"https://exe.dev/apple-touch-icon.png",alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx("svg",{viewBox:"0 0 24 24",focusable:"false",children:s==="cloudflare"?e.jsx("path",{d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268Zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"}):e.jsx("path",{d:"m12 1.608 12 20.784H0Z"})})})}function F(s){const n=(s??"").trim().toLowerCase();return n?n.includes("claude")?"claude":n.includes("codex")?"codex":n.includes("cursor")?"cursor":n.includes("kimi")||n.includes("moonshot")?"kimi":n.includes("minimax")?"minimax":n.includes("github")?"github":n.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown":"unknown"}function P(s){return Be[s]??pe(s)}function We(s){switch(s){case"weekly":return"7d";case"req/h":return"1h";default:return s||"quota"}}function I(s){return s.windows&&s.windows.length>0?s.windows:[{label:We(s.unitLabel),fill:s.fill,usedLabel:s.usedLabel,capLabel:s.capLabel,unitLabel:s.unitLabel,resetAt:s.resetAt}]}function Ve(s){return s.capLabel==="100%"&&s.usedLabel.endsWith("%")?s.usedLabel:`${s.usedLabel}/${s.capLabel}`}function re(s){return s>=.9?"err":s>=.75?"warn":"ok"}function Ke(s,n=30){const a=s??[];if(a.length<=n)return a;if(n<=1)return[a[a.length-1]];const t=(a.length-1)/(n-1);return Array.from({length:n},(i,o)=>a[Math.round(o*t)])}function H(s){const n=Math.floor((s-Date.now())/1e3),a=n<0,t=Math.abs(n);let i;if(t>=86400){const o=Math.floor(t/86400),r=Math.floor(t%86400/3600);i=r>0?`${o}d ${r}h`:`${o}d`}else if(t>=3600){const o=Math.floor(t/3600),r=Math.floor(t%3600/60);i=r>0?`${o}h ${r}m`:`${o}h`}else i=`${Math.max(1,Math.floor(t/60))}m`;return a?`stale ${i}`:i}function Xe(s){if(!s)return null;const n=S(s.capturedAt);if(n)return n;if(s.kind!=="quota")return null;const a=I(s).reduce((t,i)=>{const o=S(i.capturedAt);return Math.max(t??0,o??0)||t},null);return a||I(s).flatMap(t=>t.history??[]).reduce((t,i)=>{const o=S(i.capturedAt);return Math.max(t??0,o??0)||t},null)}function Ze({provider:s,onImported:n}){const[a,t]=m.useState(!1),[i,o]=m.useState(""),[r,c]=m.useState(!1),[l,h]=m.useState(null),u=`hs-${s}-dashboard-capture`,d=P(s);if(!a)return e.jsxs("button",{type:"button",className:"hs-dashboard-capture-trigger",onClick:()=>t(!0),children:[e.jsx(Fe,{size:12,"aria-hidden":"true"}),"Import dashboard"]});const p=async x=>{if(x.preventDefault(),!(!i.trim()||r)){c(!0),h(null);try{await Z("/api/service-budgets/dashboard-import",{method:"POST",body:JSON.stringify({provider:s,text:i})}),o(""),h("Usage snapshot imported."),await n()}catch(v){h(v instanceof Error?v.message:String(v))}finally{c(!1)}}};return e.jsxs("form",{className:"hs-dashboard-capture",onSubmit:x=>{p(x)},children:[e.jsxs("label",{htmlFor:u,children:[d," usage snapshot"]}),e.jsxs("p",{children:[s==="cursor"?"Paste the exported Usage CSV or copied usage table.":"Copy the signed-in Usage panel and paste it here."," ","Scout keeps only normalized totals, not this text."]}),e.jsx("textarea",{id:u,value:i,onChange:x=>o(x.target.value),maxLength:128*1024,rows:5,placeholder:s==="cursor"?"Date (UTC),Type,Model,Tokens,Cost…":"Weekly SuperGrok… Limit · 12% used · Resets…","aria-describedby":l?`${u}-message`:void 0}),l?e.jsx("span",{id:`${u}-message`,className:"hs-dashboard-capture-message",role:"status",children:l}):null,e.jsxs("div",{className:"hs-dashboard-capture-actions",children:[e.jsx("button",{type:"button",onClick:()=>{t(!1),h(null)},disabled:r,children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!i.trim()||r,children:r?"Importing…":"Use snapshot"})]})]})}function Je(s){const n=new Map(s.map(a=>[F(a.id),a]));return ie.map(({id:a})=>({id:a,label:P(a),gauge:n.get(a)??null}))}function Ye({points:s}){const n=Ke(s);return n.length===0?e.jsx("span",{className:"hs-history hs-history-empty",children:"live"}):e.jsx("span",{className:"hs-history","aria-label":`${n.length} budget samples`,children:n.map((a,t)=>{const i=Math.max(.06,Math.min(1,a.fill));return e.jsx("span",{className:`hs-history-bar hs-history-bar--${re(a.fill)}`,style:{height:`${Math.round(i*100)}%`},title:`${O(a.capturedAt)||"unknown"} ${a.usedLabel}`},`${a.capturedAt}:${t}`)})})}function es({gauge:s,window:n}){const a=Math.max(0,Math.min(100,Math.round(n.fill*100))),t=100-a,i=re(n.fill),o=Number.isFinite(n.resetAt)?new Date(n.resetAt).toISOString():void 0;return e.jsxs("div",{className:"hs-subscription-window",children:[e.jsxs("div",{className:"hs-subscription-window-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"hs-subscription-window-label",children:[n.label," window"]}),e.jsxs("strong",{className:`hs-subscription-usage hs-subscription-usage--${i}`,children:[a,"% used"]})]}),e.jsxs("div",{className:"hs-subscription-remaining",children:[e.jsxs("strong",{children:[t,"%"]}),e.jsx("span",{children:"available"})]})]}),e.jsx("div",{className:"hs-subscription-meter",role:"progressbar","aria-label":`${s.label} ${n.label} usage`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:e.jsx("span",{className:`hs-subscription-meter-fill hs-subscription-meter-fill--${i}`,style:{width:`${a}%`}})}),e.jsxs("div",{className:"hs-subscription-window-meta",children:[e.jsxs("span",{children:[Ve(n)," ",n.unitLabel==="quota"?"quota":n.unitLabel]}),e.jsxs("span",{children:["resets in ",H(n.resetAt),o?e.jsx("time",{dateTime:o,title:O(n.resetAt)||void 0,children:` · ${O(n.resetAt)||""}`}):null]})]}),e.jsx(Ye,{points:n.history})]})}function ss(){return e.jsxs("div",{className:"hs-subscription-loading","aria-hidden":"true",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--label"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--value"}),e.jsx("span",{className:"hs-loading-meter"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--meta"}),e.jsx("span",{className:"hs-loading-history"})]})}function as(s,n,a){const t=s.flatMap(i=>{if(i.kind!=="quota")return[];const o=I(i).map(r=>{const c=S(r.capturedAt??i.capturedAt),l=Math.round(Math.max(0,Math.min(1,r.fill))*1e3)/10;return{label:r.label,usedPercent:l,percentRemaining:Math.round((100-l)*10)/10,windowMs:r.windowMs??null,resetAt:S(r.resetAt),resetIn:Number.isFinite(r.resetAt)?H(r.resetAt):"",freshness:{ageMs:c?Math.max(0,a-c):null,label:c?J(c)||"now":"unknown"}}});return[{id:F(i.id),label:P(F(i.id)),plan:i.plan??null,windows:o}]});return{generatedAt:n,generatedAtLocal:O(n)||"now",providers:t}}function U(s){switch(s){case"underused":return"usage trails elapsed time";case"on_track":return"usage tracks elapsed time";case"ahead":return"usage exceeds elapsed time";default:return"pace unknown"}}function A(s){return Ne(s)}function z({text:s,label:n="Copy rule"}){const[a,t]=m.useState("idle");m.useEffect(()=>{if(a==="idle")return;const o=window.setTimeout(()=>t("idle"),1800);return()=>window.clearTimeout(o)},[a]);const i=m.useCallback(async()=>{if(typeof navigator>"u"||!navigator.clipboard){t("failed");return}try{await navigator.clipboard.writeText(s),t("copied")}catch{t("failed")}},[s]);return e.jsx("button",{type:"button",className:"hs-advisor-dispatch-copy",onClick:()=>{i()},"aria-live":"polite","aria-atomic":"true",children:a==="copied"?"Copied!":a==="failed"?"Copy failed":n})}function G(s,n){return!!(s.quotaRisk&&n&&!n.quotaRisk&&se(n.quota)&&n.route.providerId!==s.route.providerId)}function oe(s){return s.minimumRemainingPercent===null?"quota unknown":`${s.minimumRemainingPercent}% minimum remaining`}function ts(s){switch(s){case"use_now":return"Use now";case"available":return"Available";case"use_deliberately":return"Use deliberately";case"probe_first":return"Probe first";case"conserve":return"Conserve"}}function le({providerLabel:s,quota:n}){return n.windows.length===0?e.jsxs("div",{className:"hs-advisor-no-quota",children:[e.jsx("strong",{children:"No quota telemetry"}),e.jsx("span",{children:"Use one bounded ask as a canary before scaling this route."})]}):e.jsx("div",{className:"hs-advisor-windows",children:n.windows.map(a=>{const t=Math.max(0,Math.min(100,a.usedPercent)),i=a.elapsedPercent===null?null:Math.max(0,Math.min(100,a.elapsedPercent)),o=i===null?"elapsed time unavailable":`${i}% of the window elapsed`,r=a.projectedUsedPercent===null?"projection unavailable":`${a.projectedUsedPercent}% projected at reset`;return e.jsxs("div",{className:"hs-advisor-window",children:[e.jsxs("div",{className:"hs-advisor-window-head",children:[e.jsx("strong",{children:a.label}),e.jsxs("span",{children:[a.usedPercent,"% used"]}),e.jsx("span",{children:U(a.status)})]}),e.jsxs("div",{className:"hs-advisor-window-meter",role:"progressbar","aria-label":`${s} ${a.label} usage`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(t),"aria-valuetext":`${a.usedPercent}% used; ${o}; ${r}; ${U(a.status)}`,children:[e.jsx("span",{className:`hs-advisor-window-fill hs-advisor-window-fill--${a.status}`,style:{width:`${t}%`}}),i!==null?e.jsx("span",{className:"hs-advisor-window-now",style:{left:`${i}%`},title:`${i}% of the window has elapsed`,"aria-hidden":"true"}):null]}),e.jsxs("div",{className:"hs-advisor-window-meta",children:[e.jsxs("span",{children:[a.percentRemaining,"% available"]}),e.jsx("span",{children:r}),e.jsx("span",{children:a.resetIn?`resets in ${a.resetIn}`:"reset unknown"})]})]},a.label)})})}function ce({assignment:s,selected:n,onSelect:a}){return e.jsxs("button",{type:"button",className:"hs-advisor-role","data-selected":n?"true":void 0,onClick:a,"aria-pressed":n,children:[e.jsx("span",{className:"hs-advisor-role-mark",children:e.jsx(L,{harness:s.route.harness,size:25,title:null})}),e.jsxs("span",{className:"hs-advisor-role-copy",children:[e.jsx("strong",{children:s.roleLabel}),e.jsx("span",{children:s.modelLabel}),e.jsxs("small",{children:[s.route.profile?`profile ${s.route.profile}`:s.route.harness," · Fit $",s.fit]})]}),e.jsx("span",{className:`hs-advisor-role-tag ${s.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:s.quotaRisk?`⚠️ ${s.quota.minimumRemainingPercent!==null?`${s.quota.minimumRemainingPercent}%`:"Risk"}`:s.fit>=100?"Primary":`Fit ${s.fit}`})]})}function ns({map:s}){const[n,a]=m.useState("implementation"),t=s.assignments.find(r=>r.role===n)??s.assignments[0];if(!t)return null;const i=B(t.route),o=t.alternatives.find(r=>G(t,r));return e.jsxs("div",{className:"hs-advisor-layout",children:[e.jsx("nav",{className:"hs-advisor-roles","aria-label":"Work roles",children:s.assignments.map(r=>e.jsx(ce,{assignment:r,selected:r.role===t.role,onSelect:()=>a(r.role)},r.role))}),e.jsxs("article",{className:"hs-advisor-detail","aria-live":"polite",children:[e.jsxs("header",{className:"hs-advisor-detail-head",children:[e.jsxs("div",{className:"hs-advisor-model",children:[e.jsx(L,{harness:t.route.harness,size:26,title:null}),e.jsxs("div",{children:[e.jsxs("span",{children:[t.roleLabel," · Role Routing"]}),e.jsx("h4",{children:t.modelLabel}),e.jsx("code",{children:A(t.route)})]})]}),e.jsx("span",{className:`hs-advisor-fit-badge ${t.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:t.quotaRisk?"⚠️ Quota Risk · Failover Active":`Primary Route · Fit ${t.fit}`})]}),t.quotaRisk?e.jsxs("div",{className:"hs-advisor-quota-alert",role:"alert",children:[e.jsxs("div",{className:"hs-advisor-quota-alert-head",children:[e.jsx("span",{className:"hs-advisor-quota-alert-badge",children:"⚠️ Quota Risk"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Quota Exhaustion Imminent · Elevated to Primary Concern"}),e.jsx("p",{children:t.quotaRiskMessage??`${t.quota.providerLabel} quota is near capacity.`})]})]}),e.jsx("div",{className:"hs-advisor-quota-alert-action",children:o?e.jsxs("span",{children:["Failover to ",e.jsx("strong",{children:o.label})," to move work off the constrained provider."]}):e.jsx("span",{children:"No quota-safe cross-provider fallback is currently available; keep the task bounded or wait for reset."})})]}):null,e.jsxs("div",{className:"hs-advisor-task-hero",children:[e.jsxs("div",{className:"hs-advisor-task-hero-head",children:[e.jsx("h5",{children:"Task Objective"}),e.jsx("span",{children:"Cognitive Strategy"})]}),e.jsx("p",{children:t.objective}),e.jsxs("small",{children:[e.jsx("strong",{children:"Execution Rationale:"})," ",t.taskRationale]})]}),e.jsxs("div",{className:"hs-advisor-assessment",children:[e.jsxs("section",{children:[e.jsx("h5",{children:"Strengths for this task"}),e.jsx("p",{children:t.capability})]}),e.jsxs("section",{children:[e.jsx("h5",{children:"Watchouts & Guardrails"}),e.jsx("p",{children:t.caution})]})]}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Dispatch rule"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:i}),e.jsx(z,{text:i,label:"Copy rule"})]})]}),e.jsxs("section",{className:"hs-advisor-ladder",children:[e.jsx("h5",{children:"Failover ladder"}),e.jsxs("div",{className:"hs-advisor-ladder-nodes",children:[e.jsxs("div",{className:`hs-advisor-ladder-node ${t.quotaRisk?"hs-advisor-ladder-node--primary hs-advisor-ladder-node--risk":"hs-advisor-ladder-node--primary"}`,children:[e.jsx("span",{className:"hs-advisor-ladder-badge",children:t.quotaRisk?"⚠️ Primary (Quota Risk)":"Primary"}),e.jsxs("div",{className:"hs-advisor-ladder-body",children:[e.jsx("strong",{children:t.modelLabel}),e.jsx("code",{children:A(t.route)}),e.jsx("small",{children:t.quotaRisk?`Exhaustion risk (${t.quota.minimumRemainingPercent}% remaining) · ${t.taskRationale}`:`Initial execution target · ${t.taskRationale}`})]})]}),t.alternatives.map((r,c)=>{const l=G(t,r);return e.jsxs("div",{className:`hs-advisor-ladder-node ${l?"hs-advisor-ladder-node--fallback-rec":""}`,children:[e.jsx("span",{className:"hs-advisor-ladder-badge",children:l?"⭐️ Quota-safe fallback":c===0?"Secondary":"Tertiary"}),e.jsxs("div",{className:"hs-advisor-ladder-body",children:[e.jsx("strong",{children:r.label}),e.jsx("code",{children:A(r.route)}),e.jsx("small",{children:l?`Moves work off ${t.quota.providerLabel} · ${r.taskRationale}`:r.quotaRisk?`Also quota constrained; use only if operationally necessary · ${r.taskRationale}`:`Fallback if ${t.modelLabel} encounters rate limits or errors · ${r.taskRationale}`})]})]},k(r.route))})]})]}),e.jsxs("section",{className:"hs-advisor-quota-secondary",children:[e.jsxs("div",{className:"hs-advisor-quota-secondary-head",children:[e.jsxs("h5",{children:["Provider Telemetry ",t.quotaRisk?"(Active Constraint)":"(Secondary)"]}),e.jsxs("span",{children:[t.quota.providerLabel,t.quota.plan?` · ${t.quota.plan}`:""]})]}),e.jsxs("div",{className:"hs-advisor-quota-compact-bar",children:[e.jsxs("span",{children:["Allowance: ",e.jsx("strong",{children:oe(t.quota)})]}),e.jsxs("span",{children:["Pacing: ",e.jsx("strong",{children:U(t.quota.pacing)})]}),e.jsxs("span",{children:["Telemetry: ",e.jsx("strong",{children:t.quota.confidence})]}),t.quota.nextResetIn?e.jsxs("span",{children:["Next reset: ",e.jsx("strong",{children:t.quota.nextResetIn})]}):null]}),t.quotaRisk?e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(le,{providerLabel:t.quota.providerLabel,quota:t.quota})}):null]})]})]})}function is({models:s}){const n=s.find(r=>r.modelLabel==="GPT-5.6 Sol")??s[0],[a,t]=m.useState(()=>n?k(n.route):""),i=s.find(r=>k(r.route)===a)??n;if(!i)return null;const o=B(i.route);return e.jsxs("div",{className:"hs-model-guide-layout",children:[e.jsx("nav",{className:"hs-model-guide-list","aria-label":"Model Fleet",children:s.map(r=>{const c=k(r.route);return e.jsxs("button",{type:"button",className:"hs-model-guide-item","data-selected":c===k(i.route)?"true":void 0,"aria-pressed":c===k(i.route),onClick:()=>t(c),children:[e.jsx("span",{className:"hs-model-guide-mark",children:e.jsx(L,{harness:r.route.harness,size:23,title:null})}),e.jsxs("span",{className:"hs-model-guide-item-copy",children:[e.jsx("strong",{children:r.modelLabel}),e.jsxs("span",{children:[r.quota.providerLabel," · ",r.route.profile?`profile ${r.route.profile}`:r.route.harness]})]}),e.jsx("span",{className:`hs-advisor-role-tag ${r.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:r.quotaRisk?"⚠️ Conserve":ts(r.guidance)})]},c)})}),e.jsxs("article",{className:"hs-model-guide-detail","aria-live":"polite",children:[e.jsxs("header",{className:"hs-advisor-detail-head",children:[e.jsxs("div",{className:"hs-advisor-model",children:[e.jsx(L,{harness:i.route.harness,size:25,title:null}),e.jsxs("div",{children:[e.jsxs("span",{children:[i.quota.providerLabel,i.quota.plan?` · ${i.quota.plan}`:""]}),e.jsx("h4",{children:i.modelLabel}),e.jsx("code",{children:A(i.route)})]})]}),e.jsx("span",{className:`hs-advisor-fit-badge ${i.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:i.quotaRisk?"⚠️ Quota Risk · Conserve":i.roles.length>0?`${i.roles.length} Assigned Roles`:"Model Fleet"})]}),i.quotaRisk?e.jsx("div",{className:"hs-advisor-quota-alert",role:"alert",children:e.jsxs("div",{className:"hs-advisor-quota-alert-head",children:[e.jsx("span",{className:"hs-advisor-quota-alert-badge",children:"⚠️ Quota Risk"}),e.jsxs("div",{children:[e.jsx("strong",{children:"High Quota Depletion · Conserve Model"}),e.jsxs("p",{children:[i.quota.providerLabel," allowance is near capacity (",i.quota.minimumRemainingPercent,"% remaining). Conserve this model for essential high-fit tasks."]})]})]})}):null,e.jsxs("div",{className:"hs-model-guide-roles",children:[e.jsx("strong",{children:"Assigned task roles"}),e.jsx("div",{className:"hs-model-guide-role-chips",children:i.roles.map(r=>e.jsx("span",{className:"hs-model-guide-role-chip",children:r.label},r.role))})]}),e.jsxs("div",{className:"hs-advisor-assessment",children:[e.jsxs("section",{children:[e.jsx("h5",{children:"Strengths & Cognitive Profile"}),e.jsx("p",{children:i.strengths.join(" ")})]}),e.jsxs("section",{children:[e.jsx("h5",{children:"Watchouts & Guardrails"}),e.jsx("p",{children:i.cautions.join(" ")})]})]}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Direct dispatch"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:o}),e.jsx(z,{text:o,label:"Copy command"})]})]}),e.jsxs("section",{className:"hs-advisor-quota-secondary",children:[e.jsxs("div",{className:"hs-advisor-quota-secondary-head",children:[e.jsxs("h5",{children:["Provider Telemetry ",i.quotaRisk?"(Active Constraint)":"(Secondary)"]}),e.jsxs("span",{children:[i.quota.providerLabel,i.quota.plan?` · ${i.quota.plan}`:""]})]}),e.jsxs("div",{className:"hs-advisor-quota-compact-bar",children:[e.jsxs("span",{children:["Allowance: ",e.jsx("strong",{children:oe(i.quota)})]}),e.jsxs("span",{children:["Pacing: ",e.jsx("strong",{children:U(i.quota.pacing)})]}),e.jsxs("span",{children:["Telemetry: ",e.jsx("strong",{children:i.quota.confidence})]}),i.quota.nextResetIn?e.jsxs("span",{children:["Next reset: ",e.jsx("strong",{children:i.quota.nextResetIn})]}):null]}),i.quotaRisk?e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(le,{providerLabel:i.quota.providerLabel,quota:i.quota})}):null]})]})]})}function rs({assignments:s}){const[n,a]=m.useState("implementation"),[t,i]=m.useState({}),o=s.find(d=>d.role===n)??s[0];if(!o)return null;const r=[{label:o.modelLabel,route:o.route,capability:o.capability,taskRationale:o.taskRationale,quota:o.quota,quotaRisk:o.quotaRisk},...o.alternatives.map(d=>({label:d.label,route:d.route,capability:d.capability,taskRationale:d.taskRationale,quota:d.quota,quotaRisk:d.quotaRisk}))],c=t[o.role],l=c?c.flatMap(d=>{const p=r.find(x=>k(x.route)===d);return p?[p]:[]}):r,h=d=>{const p=l.map(x=>k(x.route));i(x=>({...x,[o.role]:[d,...p.filter(v=>v!==d)]}))},u=B(l[0].route);return e.jsxs("div",{className:"hs-cascade-layout",children:[e.jsx("nav",{className:"hs-advisor-roles","aria-label":"Cascade roles",children:s.map(d=>e.jsx(ce,{assignment:d,selected:d.role===o.role,onSelect:()=>a(d.role)},d.role))}),e.jsxs("article",{className:"hs-cascade-editor",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("span",{children:[o.roleLabel," · Failover Hierarchy"]}),e.jsx("h4",{children:"Task Escalation Sequence"}),e.jsx("p",{children:"Hierarchical fallback sequence when models encounter rate limits, timeouts, or task complexity thresholds."})]}),c?e.jsx("button",{type:"button",onClick:()=>i(d=>{const p={...d};return delete p[o.role],p}),children:"Reset suggested order"}):e.jsx("span",{children:"Default policy"})]}),e.jsx("ol",{className:"hs-cascade-workflow",children:l.map((d,p)=>{const x=k(d.route),v=p>0&&G(l[0],d),f=p===0?"Primary Route":p===1?"Secondary Fallback":"Tertiary Fallback",g=p===0?d.quotaRisk?`Initial target (⚠️ Quota Risk: ${d.quota.minimumRemainingPercent}% remaining) · ${d.taskRationale}`:`Initial execution target · ${d.taskRationale}`:p===1?v?`⭐️ Quota-safe route off ${l[0].quota.providerLabel} · ${d.taskRationale}`:`Triggered if primary encounters rate limits, errors, or complexity threshold · ${d.taskRationale}`:`Emergency baseline fallback · ${d.taskRationale}`;return e.jsxs("li",{className:"hs-cascade-node",children:[e.jsx("span",{className:"hs-cascade-node-index",children:p+1}),e.jsxs("div",{className:"hs-cascade-node-main",children:[e.jsx("span",{children:f}),e.jsx("strong",{children:d.label}),e.jsx("code",{children:A(d.route)}),e.jsx("p",{children:d.capability}),e.jsx("small",{children:g})]}),e.jsxs("div",{className:"hs-cascade-node-side",children:[e.jsx("em",{className:d.quotaRisk?"hs-advisor-tone--warn":"",children:d.quota.minimumRemainingPercent===null?"quota unknown":`${d.quota.minimumRemainingPercent}% quota remaining`}),p>0?e.jsx("button",{type:"button",onClick:()=>h(x),children:"Make primary"}):null]})]},`${o.role}:${x}`)})}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Primary dispatch command"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:u}),e.jsx(z,{text:u,label:"Copy primary command"})]})]})]})]})}function os({map:s,loading:n,bias:a,onBiasChange:t}){const[i,o]=m.useState("tasks"),r={tasks:"Task-first model routing: Map each role to the optimal cognitive profile and failover ladder.",models:"Model fleet inventory: Inspect cognitive strengths, guardrails, and assigned roles across all models.",cascades:"Failover & escalation rules: Review and customize the task escalation sequence for each role."};return e.jsxs("section",{className:"hs-advisor","aria-labelledby":"hs-orchestrator-map-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-advisor-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-orchestrator-map-title",children:"Orchestrator map"}),e.jsx("p",{children:r[i]})]}),e.jsxs("div",{className:"hs-advisor-head-tools",children:[e.jsx("span",{className:"hs-section-meta",children:n?"refreshing inputs":"advisory · no dispatch"}),e.jsxs("label",{className:"hs-routing-bias",children:[e.jsx("span",{children:"Routing bias"}),e.jsx("input",{type:"range",min:0,max:M.length-1,step:1,value:M.findIndex(c=>c.value===a),"aria-valuetext":M.find(c=>c.value===a)?.label,onChange:c=>{const l=M[Number(c.target.value)];l&&t(l.value)}}),e.jsx("small",{"aria-hidden":"true",children:M.map(c=>e.jsx("i",{"data-active":c.value===a?"true":void 0,children:c.label},c.value))})]})]})]}),e.jsx("div",{className:"hs-routing-angles",role:"group","aria-label":"Orchestrator map angle",children:[["tasks","Task map"],["models","Model fleet"],["cascades","Cascades"]].map(([c,l])=>e.jsx("button",{type:"button","aria-pressed":i===c,onClick:()=>o(c),children:l},c))}),i==="tasks"?e.jsx(ns,{map:s}):null,i==="models"?e.jsx(is,{models:s.models}):null,i==="cascades"?e.jsx(rs,{assignments:s.assignments}):null]})}function ls({rows:s,loading:n,onImported:a}){const t=ie.map(l=>({provider:l,row:s.find(h=>h.id===l.id)??null})),i=t.filter(({row:l})=>l?.gauge).length,o=t.filter(({row:l})=>l?.gauge?.kind==="quota").length,r=t.filter(({row:l})=>l?.gauge?.kind==="quota"&&l.gauge.plan||l?.gauge?.kind==="status").length,c=t.flatMap(({row:l})=>l?.gauge?.kind==="quota"?I(l.gauge):[]).map(l=>l.resetAt).filter(l=>l>Date.now()).sort((l,h)=>l-h)[0];return e.jsxs("section",{className:"hs-subscriptions","aria-labelledby":"hs-subscriptions-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-subscriptions-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-subscriptions-title",children:"Subscriptions"}),e.jsx("p",{children:"Plans, remaining allowance, reset windows, and the fastest path to each provider dashboard."})]}),e.jsxs("div",{className:"hs-subscription-summary","aria-label":"Subscription feed summary",children:[e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":i})," detected"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":o})," usage feeds"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":r})," plans named"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":c?H(c):"-"})," next reset"]})]})]}),e.jsx("div",{className:"hs-subscription-grid",children:t.map(({provider:l,row:h})=>{const u=h?.gauge??null,d=n&&!u,p=d?"loading":u?"connected":"missing",x=u?.kind==="quota"?u.plan:u?.kind==="status"?u.statusLabel:null,v=Xe(u),f=u?.kind==="quota"?"Usage connected":u?.kind==="status"?u.detailLabel||"Subscription detected":d?"Checking":"Not detected";return e.jsxs("article",{className:`hs-subscription-card hs-subscription-card--${p}`,children:[e.jsxs("header",{className:"hs-subscription-card-head",children:[e.jsxs("div",{className:"hs-subscription-provider",children:[e.jsx(L,{harness:l.id,size:18,title:null,className:"hs-subscription-mark"}),e.jsxs("div",{children:[e.jsx("h4",{children:P(l.id)}),e.jsx("span",{children:d?"Checking local plan…":x||"Plan not reported"})]})]}),e.jsx("span",{className:`hs-subscription-state hs-subscription-state--${p}`,children:f})]}),e.jsx("p",{className:"hs-subscription-description",children:l.description}),d?e.jsx(ss,{}):u?.kind==="quota"?e.jsx("div",{className:"hs-subscription-windows",children:I(u).map(g=>e.jsx(es,{gauge:u,window:g},`${l.id}:${g.label}`))}):u?.kind==="status"?e.jsxs("div",{className:"hs-subscription-status-detail",children:[e.jsx("strong",{children:u.statusLabel}),e.jsx("span",{children:u.detailLabel||"Subscription detected locally. Open the provider dashboard for live usage."})]}):e.jsxs("div",{className:"hs-subscription-missing",children:[e.jsx("strong",{children:"No local subscription feed yet"}),e.jsx("span",{children:"Open the provider locally, then refresh Scout."})]}),l.id==="cursor"||l.id==="grok"&&u?.kind!=="quota"?e.jsx(Ze,{provider:l.id,onImported:a}):null,e.jsxs("footer",{className:"hs-subscription-footer",children:[e.jsxs("span",{children:[d?"checking local feed":v?`updated ${J(v)||"now"}`:u?"detected locally":"waiting for provider data",u?.source?` · ${u.source}`:""]}),e.jsx("nav",{"aria-label":`${P(l.id)} quick links`,children:l.links.map(g=>e.jsxs("a",{href:g.href,target:"_blank",rel:"noreferrer",children:[g.label,e.jsx(Y,{size:11,"aria-hidden":"true"})]},g.href))})]})]},l.id)})})]})}function cs({accounts:s,loading:n}){return s.length===0&&!n?null:e.jsxs("section",{className:"hs-cloud-accounts","aria-labelledby":"hs-cloud-accounts-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-cloud-accounts-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-cloud-accounts-title",children:"Cloud accounts"}),e.jsx("p",{children:"Infrastructure available to Scout for deployment and agent compute."})]}),e.jsx("span",{className:"hs-section-meta",children:n?"checking accounts":`${s.length} connected`})]}),e.jsxs("div",{className:"hs-cloud-grid",children:[n&&s.length===0?Array.from({length:3},(a,t)=>e.jsxs("article",{className:"hs-cloud-card hs-cloud-card--loading","aria-hidden":"true",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsx("span",{className:"hs-loading-mark"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-title"})]}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-copy"}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-meta"}),e.jsx("span",{className:"hs-loading-actions"})]})]},t)):null,s.map(a=>{const t=ze[a.id];return e.jsxs("article",{className:"hs-cloud-card",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsxs("div",{className:"hs-cloud-identity",children:[e.jsx(Qe,{provider:a.id}),e.jsxs("div",{children:[e.jsx("span",{className:"hs-cloud-category",children:t.category}),e.jsx("h4",{children:a.label})]})]}),e.jsx("span",{className:"hs-subscription-state hs-subscription-state--connected",children:a.statusLabel})]}),e.jsx("p",{className:"hs-cloud-description",children:t.description}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsxs("span",{className:"hs-cloud-connection",children:[e.jsx("span",{className:"hs-cloud-dot","aria-hidden":"true"}),a.detailLabel]}),e.jsx("nav",{"aria-label":`${a.label} quick links`,children:He[a.id].map(i=>e.jsxs("a",{href:i.href,target:"_blank",rel:"noreferrer",children:[i.label,e.jsx(Y,{size:11,"aria-hidden":"true"})]},i.href))})]})]},a.id)})]})]})}function ra({navigate:s}){const{route:n}=ge(),a=fe(n),[t]=m.useState(()=>me("/api/service-budgets",Ge)),[i,o]=m.useState(t?.gauges??[]),[r,c]=m.useState(t?.cloudAccounts??[]),[l,h]=m.useState("budget"),[u,d]=m.useState(()=>S(t?.generatedAt)??Date.now()),[p,x]=m.useState("balanced"),[v,f]=m.useState(t===null),[g,q]=m.useState(!1),[T,Q]=m.useState(null),_=m.useRef(0),W=m.useRef(t!==null),R=m.useCallback(async(y=!1,C=!1)=>{const E=++_.current;C&&!W.current&&f(!0),q(!0),Q(null);try{const w=await Z(`/api/service-budgets${y?"?refresh=1":""}`);if(E!==_.current)return;W.current=!0,o(w.gauges??[]),d(S(w.generatedAt)??Date.now()),c(w.cloudAccounts??[])}catch(w){E===_.current&&Q(w instanceof Error?w.message:String(w))}finally{E===_.current&&(f(!1),q(!1))}},[]);m.useEffect(()=>{let y=!1,C;return R(!1,!0).then(()=>{y||(C=window.setTimeout(()=>{R(!0)},600))}),()=>{y=!0,C!==void 0&&window.clearTimeout(C)}},[R]),m.useEffect(()=>{const y=window.setInterval(()=>{R(!1)},3e4);return()=>window.clearInterval(y)},[R]);const de=m.useMemo(()=>Je(i),[i]),ue=m.useMemo(()=>{const y=Date.now();return we(as(i,u,y),{now:y,bias:p})},[u,p,i]),he=xe();return e.jsxs("div",{className:"s-ops",children:[he?e.jsx("div",{className:"s-ops-header",children:e.jsx(be,{activeRoute:{view:"harnesses",...a?{machineId:a}:{}},navigate:s})}):null,e.jsx("div",{className:"s-ops-body hs-body",children:e.jsxs("div",{className:"hs-page",children:[e.jsxs("header",{className:"hs-page-head",children:[e.jsxs("div",{className:"hs-title-group",children:[e.jsx("span",{className:"hs-kicker",children:"ops / provider central"}),e.jsx("h2",{children:"Agent Providers"}),e.jsx("p",{children:l==="budget"?"See what you pay for, how much remains, and where to use it.":"Map each kind of work to a model and provider route using live quota posture."})]}),e.jsxs("div",{className:"hs-page-actions",children:[e.jsxs("div",{className:"hs-view-switch",role:"group","aria-label":"Provider view",children:[e.jsx("button",{type:"button","aria-pressed":l==="budget",onClick:()=>h("budget"),children:"Budget"}),e.jsx("button",{type:"button","aria-pressed":l==="routing",onClick:()=>h("routing"),children:"Routing"})]}),e.jsxs("button",{type:"button",className:"hs-refresh",disabled:g,onClick:()=>{R(!0)},children:[e.jsx(ve,{size:14,className:g?"hs-refresh-icon-spinning":"","aria-hidden":"true"}),e.jsx("span",{children:g?"Refreshing":"Refresh"})]})]})]}),T&&e.jsxs("div",{className:"hs-error",role:"status","aria-live":"polite",children:["refresh: ",T]}),l==="budget"?e.jsxs("div",{id:"hs-budget-view",className:"hs-provider-view",children:[e.jsx(ls,{rows:de,loading:v,onImported:()=>R(!1)}),e.jsx(cs,{accounts:r,loading:v})]}):e.jsx("div",{id:"hs-routing-view",className:"hs-provider-view",children:e.jsx(os,{map:ue,loading:v,bias:p,onBiasChange:x})})]})})]})}export{ra as HarnessesScreen};
|
|
1
|
+
import{r as m,j as e}from"./index-DvLtl7rV.js";import{H as L,h as pe}from"./HarnessMark-B979GCSB.js";import{p as me,a as Z}from"./api-Co9aQ2Jw.js";import{b as fe}from"./router-B9vQkNJL.js";import{n as S,t as J,f as O}from"./time-Dhsh_2EG.js";import{u as ge}from"./Provider-CtXJeLrP.js";import{u as xe}from"./useContentSecondaryNav-pZe2Zfk1.js";import{OpsSubnav as be}from"./OpsSubnav-1K4Jaf__.js";/* empty css */import{R as ve}from"./refresh-cw-DMxGzDwn.js";import{E as Y}from"./external-link-Dp_a2vRZ.js";import{c as je}from"./createLucideIcon-DezKXSG2.js";import"./perf-PX8Rx0EP.js";import"./synthetic-agent-routing-aduMYO7P.js";import"./terminal-sessions-BQ6t92tJ.js";import"./sse-CD9MMUxl.js";import"./index-BWHgHrtv.js";import"./surface-activity-B1rgWB1i.js";import"./colors-BtO5_zlx.js";import"./scoutbot-BJIamJOH.js";import"./DocumentFocusViewer-Do3wQ_3Z.js";import"./TextDocumentSurface-BflAwXeZ.js";import"./file-text-CqJgwxmv.js";import"./x-CAbNespN.js";import"./chevron-right-D-HdlPg8.js";import"./code-xml-D7pOQM9l.js";import"./arrow-left-Czpf-AE4.js";import"./arrow-right-BuzMnLYP.js";import"./scout-voice-BVUqGhth.js";import"./fx-z37u1o2z.js";import"./keyboard-nav-BLYDhL3Z.js";import"./NewChatComposer-_Stj0fZy.js";import"./text-BP3oyl8-.js";import"./voice-levels-Dcr3jglk.js";import"./loader-circle-pM56HNhR.js";import"./conversation-model-Dc02NsGp.js";import"./index-zvhpRHao.js";import"./NewChatOrigin-B1u7ki70.js";import"./chevron-down-wciXnOQz.js";import"./search-CDko0PKE.js";import"./chunk-HRAB3GC3-Tyv9rzx7.js";import"./SecondaryNav-BR4VRdgh.js";import"./secondaryNavConfig-BoQ_zYR9.js";import"./message-square-C7t_qtuj.js";import"./compass-Dt1AMXz2.js";import"./settings-Dyvpkb1D.js";import"./terminal-9GRS_Qdc.js";import"./git-branch-CK5v8F2v.js";import"./scroll-text-Dze_dXtQ.js";/* empty css */const D=60*6e4,N=24*D,ke=["product_judgment","large_context_synthesis","adversarial_critique","evidence_inventory","implementation","code_review"],V={fable:j("Fable 5","claude","claude","claude-fable-5","max","Fable","Premium product taste, rapid design iterations, and premise-level critique.","Uses the premium shared Claude allowance; do not spend it on routine mechanical work."),sol:j("GPT-5.6 Sol","codex","codex","gpt-5.6-sol","xhigh",null,"Load-bearing coding, debugging, integration, and technically grounded judgment.","Highest Codex tier; reserve deep turns for work where failure is expensive."),grok:j("Grok 4.6","grok","grok","grok-4.6",null,"Grok","Independent assumption checking, deletion pressure, and adversarial critique.","Do not make it the sole implementation authority; verify conclusions against repository evidence."),kimi:j("Kimi Code","kimi","kimi",null,null,"Kimi","Dense repository and study synthesis through the native Kimi harness.","The harness owns the concrete model and quota telemetry can be stale; probe before large fan-out."),opus:j("Opus 5","claude","claude","claude-opus-5","high","Opus","Long-context synthesis, nuanced architecture, and coherent product reasoning.","Premium shared Claude quota; avoid routine scans and repetitive verification."),glm:j("GLM-5.2","opencode","opencode","opencode-go/glm-5.2",null,"OpenCode","Independent broad-context synthesis through OpenCode.","OpenCode quota is not visible in Scout; use a bounded canary before scaling."),terra:j("GPT-5.6 Terra","codex","codex","gpt-5.6-terra","high",null,"Balanced implementation, correctness review, and technical critique.","Prefer Sol for the hardest integration boundary when its additional spend is justified."),minimax:j("MiniMax M3","minimax","opencode","opencode-go/minimax-m3",null,"OpenCode","Cost-effective structured evidence collection and comparison.","Verify load-bearing conclusions with a stronger reviewer before acceptance."),luna:j("GPT-5.6 Luna","codex","codex","gpt-5.6-luna","medium",null,"Inexpensive source mapping, test enumeration, and mechanical audit work.","Keep it out of sole high-stakes product judgment and final acceptance."),haiku:j("Haiku 4.5","claude","claude","claude-haiku-4-5","low",null,"Fast narrow scans and classification inside the Claude harness.","Lighter reasoning and a smaller context window make broad synthesis a poor fit."),sonnet:j("Sonnet 4.6","claude","claude","claude-sonnet-4-6","high",null,"Strong generalist implementation with a large context window.","Shares Claude's provider allowance and can become a poor choice when that pool is guarded."),deepseek:j("DeepSeek V4 Pro","opencode","opencode","opencode-go/deepseek-v4-pro",null,"OpenCode","Code-centric review through an independent model lineage.","Quota is opaque and findings should not be the sole acceptance authority.")},ee={product_judgment:{label:"Product judgment",objective:"Strategic tradeoffs, UX prioritization, scope shaping, and high-level product decisions.",strategy:"Select models with high nuanced taste, product-level synthesis, and clear communication of architectural tradeoffs.",candidates:[b("fable",100,"Unmatched product taste, rapid design iteration synthesis, and high-fidelity UX direction."),b("sol",87,"Technically grounded product decisions with strong execution realism."),b("grok",82,"Unfiltered perspective on feature bloat and aggressive scope reduction.")]},large_context_synthesis:{label:"Large-context synthesis",objective:"Repository-wide investigations, deep architectural archaeology, and multi-file code synthesis.",strategy:"Select models with expansive effective context windows and high-density information compression.",candidates:[b("kimi",100,"Native long-context retrieval and dense codebase relationship synthesis."),b("opus",91,"Deep structural understanding across complex multi-package repositories."),b("glm",84,"Independent wide-window scanning and structural cross-referencing.")]},adversarial_critique:{label:"Adversarial critique",objective:"Challenging design assumptions, rapid design iteration critique, identifying UX/logic gaps, and applying deletion pressure.",strategy:"Select high-taste and contrarian model lineages that stress-test design iterations and probe corner cases without sycophantic approval.",candidates:[b("fable",100,"High-fidelity design critique, rapid UX/visual iteration stress-testing, and premise challenge."),b("grok",91,"Contrarian perspective, uncompromising edge-case discovery, and aggressive premise challenge."),b("terra",84,"Rigorous technical inspection of code correctness and runtime invariants.")]},evidence_inventory:{label:"Evidence inventory",objective:"Grep and AST inventory, reference tracing, log audit, and structured fact collection.",strategy:"Select fast, cost-effective models with high precision on structured evidence gathering.",candidates:[b("minimax",100,"Fast, cost-effective structured evidence indexing and pattern enumeration."),b("luna",95,"Low-latency source tracing, test inventory, and reference mapping."),b("haiku",87,"Rapid mechanical file scans and categorization.")]},implementation:{label:"Implementation",objective:"Code creation, refactoring, type checking, unit test writing, and bug fixing.",strategy:"Select code-generation champions with high instruction following and strong language typing skills.",candidates:[b("sol",100,"Deep technical accuracy, robust multi-file refactors, and complex logic execution."),b("terra",91,"Reliable structured implementation with strong type-system adherence."),b("sonnet",87,"Strong generalist coding with fast turn times and clear explanations.")]},code_review:{label:"Code review",objective:"Diff analysis, security audit, regression detection, and style conformity.",strategy:"Select models with high sensitivity to subtle bugs, invariant violations, and edge-case behaviors.",candidates:[b("terra",100,"Strict invariant checking, subtle logic flaw detection, and boundary test coverage."),b("opus",96,"High-level architectural consistency and API surface evolution review."),b("deepseek",87,"Independent second-opinion review focused on code-level edge cases.")]}};function $(s){return s.availability==="constrained"||s.availability==="guarded"||s.minimumRemainingPercent!==null&&s.minimumRemainingPercent<=20||s.pacing==="ahead"&&(s.minimumRemainingPercent??100)<=35}function se(s){return s.confidence==="fresh"&&s.minimumRemainingPercent!==null&&!$(s)}function ye(s){return $(s)?s.minimumRemainingPercent!==null&&s.minimumRemainingPercent<=15?`${s.providerLabel} is near capacity (${s.minimumRemainingPercent}% remaining). High risk of quota exhaustion.`:s.pacing==="ahead"?`${s.providerLabel} consumption rate exceeds window pace with limited buffer.`:`${s.providerLabel} quota availability is ${s.availability}. Failover recommended.`:null}function k(s){return[s.providerId,s.harness,s.model,s.effort,s.profile].join("|")}function Ne(s){return[s.profile?`profile ${s.profile}`:s.harness,s.model,s.effort].filter(Boolean).join(" / ")}function Re(s,n="<request>"){const a=s.profile?.trim().toLowerCase()??null,t=a!=="opencode"&&a!=="oc",i=s.profile&&t?["--profile",s.profile]:["--harness",s.harness,...s.model?["--model",s.model]:[]];return s.effort&&i.push("--effort",s.effort),i.push(n),i}function B(s,n="<request>"){return["scout","ask",...Re(s,n)].map(_e).join(" ")}function we(s,n={}){const a=ne(n.now)??Date.now(),t=n.bias??"balanced",i=Me(t),o=new Map(s.providers.map(h=>[h.id,qe(h,a)])),r=n.role?[n.role]:[...ke],c=r.map(h=>{const u=ee[h],d=u.candidates.map(f=>{const g=o.get(f.route.providerId)??ae(f.route.providerId);return{runtime:f,quota:g,score:f.fit+Ae(g,a)*i}}).sort((f,g)=>g.score-f.score||g.runtime.fit-f.runtime.fit),p=d[0],x=$(p.quota),v=d.slice(1);return x&&v.sort((f,g)=>{const q=K(f,p.runtime.route.providerId),T=K(g,p.runtime.route.providerId);return q-T||g.score-f.score||g.runtime.fit-f.runtime.fit}),{role:h,roleLabel:u.label,modelLabel:p.runtime.label,route:p.runtime.route,score:p.score,fit:p.runtime.fit,objective:u.objective,taskRationale:p.runtime.taskRationale,capability:p.runtime.capability,caution:p.runtime.caution,assertion:Le(p.quota),quotaRisk:x,quotaRiskMessage:ye(p.quota),quota:p.quota,alternatives:v.slice(0,2).map(({runtime:f,quota:g,score:q})=>({label:f.label,route:f.route,score:q,fit:f.fit,capability:f.capability,caution:f.caution,taskRationale:f.taskRationale,quotaRisk:$(g),quota:g}))}}),l=Se(r,o,a);return{generatedAt:s.generatedAt,generatedAtLocal:s.generatedAtLocal,evaluatedAt:a,assignments:c,models:l,bias:t}}function Se(s,n,a){const t=new Map;for(const i of s){const o=ee[i];for(const r of o.candidates){const c=k(r.route),l=t.get(c);l?l.roles.push({role:i,label:o.label}):t.set(c,{runtime:r,roles:[{role:i,label:o.label}]})}}return[...t.values()].map(({runtime:i,roles:o})=>{const r=n.get(i.route.providerId)??ae(i.route.providerId);return{modelLabel:i.label,route:i.route,roles:o,strengths:[i.capability],cautions:[i.caution],guidance:Ce(r,a),quotaRisk:$(r),quota:r}})}function qe(s,n){const a=s.windows.filter(h=>!/^video\b/iu.test(h.label)).map(h=>$e(h,n)),t=[...a].sort((h,u)=>h.percentRemaining-u.percentRemaining)[0]??null,i=a.filter(h=>h.paceRatio!==null).sort((h,u)=>u.paceRatio-h.paceRatio)[0]??null,o=a.map(h=>h.confidence),r=o.includes("stale")?"stale":o.includes("fresh")?"fresh":"unknown",c=[...a].filter(h=>h.resetAt!==null&&h.resetAt>n).sort((h,u)=>h.resetAt-u.resetAt)[0]??null,l=t?.percentRemaining??null;return{providerId:s.id,providerLabel:s.label,plan:s.plan,availability:Te(l),pacing:i?.status??"unknown",confidence:r,minimumRemainingPercent:l,bindingWindow:t?.label??null,nextResetAt:c?.resetAt??null,nextResetIn:c?.resetIn??"",windows:a}}function $e(s,n){const a=ne(s.windowMs)??Pe(s.label,s.resetAt),t=a!==null&&s.resetAt!==null?X(Ue(100-(s.resetAt-n)/a*100,0,100)):null,i=t!==null&&t>=1?De(s.usedPercent/t):null,o=i===null?null:X(i*100),r=Ie(s.usedPercent,t,i),c=a===null?N:Math.min(N,Math.max(D,a/4)),l=s.freshness.ageMs===null?"unknown":s.freshness.ageMs>c?"stale":"fresh";return{label:s.label,usedPercent:s.usedPercent,percentRemaining:s.percentRemaining,durationMs:a,elapsedPercent:t,paceRatio:i,projectedUsedPercent:o,status:r,resetAt:s.resetAt,resetIn:s.resetIn,freshness:s.freshness.label,confidence:l}}function j(s,n,a,t,i,o,r,c){return{label:s,route:{providerId:n,harness:a,model:t,effort:i,profile:o},capability:r,caution:c}}function b(s,n,a){return{...V[s],fit:n,taskRationale:a??V[s].capability}}function Ce(s,n){return $(s)?"conserve":s.confidence!=="fresh"?"probe_first":s.availability==="constrained"?"conserve":s.nextResetAt!==null&&s.nextResetAt>n&&s.nextResetAt-n<=N&&s.pacing!=="ahead"&&(s.minimumRemainingPercent??0)>=10?"use_now":s.availability==="guarded"?"conserve":s.pacing==="ahead"?"use_deliberately":s.availability==="abundant"&&s.pacing==="underused"?"use_now":"available"}function Me(s){switch(s){case"capability":return .25;case"quota":return 1.75;case"balanced":return 1}}function Ae(s,n){let a=0;switch(s.availability){case"abundant":a+=10;break;case"available":a+=5;break;case"guarded":a-=5;break;case"constrained":a-=30;break;case"unknown":a-=2;break}return s.pacing==="underused"&&(a+=5),s.pacing==="ahead"&&(a-=8),s.confidence==="stale"&&(a-=8),s.confidence==="unknown"&&(a-=3),s.pacing==="underused"&&s.nextResetAt!==null&&s.nextResetAt>n&&s.nextResetAt-n<=2*N&&(a+=3),a}function Le(s){if(s.minimumRemainingPercent===null)return`${te(s.providerId)} quota telemetry unavailable; use a bounded canary before scaling.`;const n=s.pacing==="on_track"?"usage tracks elapsed time":s.pacing==="underused"?"usage trails elapsed time":s.pacing==="ahead"?"usage exceeds elapsed time":"pace unknown",a=s.nextResetIn?` · next reset ${s.nextResetIn}`:"";return`${Oe(s.minimumRemainingPercent)} minimum remaining · ${n} · telemetry ${s.confidence}${a}.`}function ae(s){return{providerId:s,providerLabel:te(s),plan:null,availability:"unknown",pacing:"unknown",confidence:"unknown",minimumRemainingPercent:null,bindingWindow:null,nextResetAt:null,nextResetIn:"",windows:[]}}function Pe(s,n){const a=s.trim().toLowerCase(),t=a.match(/(?:^|\s)(\d+(?:\.\d+)?)([hd])$/u);if(t){const i=Number(t[1]);return t[2]==="h"?i*D:i*N}if(a==="weekly"||a==="week"||a==="7-day")return 7*N;if(a==="5-hour")return 5*D;if(a==="monthly"||a==="month"){if(n===null)return 30*N;const i=new Date(n),o=new Date(n);o.setUTCMonth(o.getUTCMonth()-1);const r=i.getTime()-o.getTime();return r>0?r:30*N}return null}function Ie(s,n,a){if(n===null||a===null)return"unknown";const t=s-n;return a>1.1&&t>3?"ahead":a<.7&&t<-10?"underused":"on_track"}function Te(s){return s===null?"unknown":s>=60?"abundant":s>=30?"available":s>=15?"guarded":"constrained"}function K(s,n){const a=se(s.quota),t=s.runtime.route.providerId!==n;return a&&t?0:a?1:t?2:3}function _e(s){return/^[A-Za-z0-9_./:@%+=,-]+$/u.test(s)?s:`'${s.replaceAll("'",`'"'"'`)}'`}function te(s){return s.split(/[-_\s]+/u).filter(Boolean).map(n=>`${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ")||"Unknown"}function Oe(s){return`${Number.isInteger(s)?s.toFixed(0):s.toFixed(1)}%`}function ne(s){return typeof s=="number"&&Number.isFinite(s)?s:null}function X(s){return Math.round(s*10)/10}function De(s){return Math.round(s*100)/100}function Ue(s,n,a){return Math.min(a,Math.max(n,s))}const Ee=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Fe=je("clipboard-paste",Ee),Ge=3e4,M=[{value:"capability",label:"Capability"},{value:"balanced",label:"Balanced"},{value:"quota",label:"Quota"}],Be={codex:"Codex",claude:"Claude",kimi:"Kimi",minimax:"MiniMax",cursor:"Cursor",native:"Native",worker:"Worker",bridge:"Bridge",http:"HTTP",pi:"Pi",flue:"Flue",github:"GitHub",unknown:"Unknown"},ie=[{id:"claude",description:"Anthropic plan windows captured from Claude Code.",links:[{label:"Usage",href:"https://claude.ai/settings/usage"},{label:"Manage plan",href:"https://claude.ai/settings/billing"}]},{id:"codex",description:"OpenAI plan windows reported by local Codex sessions.",links:[{label:"Usage",href:"https://chatgpt.com/codex/settings/usage"},{label:"Open Codex",href:"https://chatgpt.com/codex"}]},{id:"kimi",description:"Kimi Code subscription windows and membership level.",links:[{label:"Kimi Code",href:"https://www.kimi.com/code"},{label:"Docs",href:"https://www.kimi.com/code/docs/en/"}]},{id:"grok",description:"SuperGrok quota reported by local Grok, with dashboard capture and local activity as fallbacks.",links:[{label:"Open Grok",href:"https://grok.com/"},{label:"Billing",href:"https://grok.com/?_s=billing"},{label:"Help",href:"https://docs.x.ai/grok/faq"}]},{id:"minimax",description:"MiniMax Token Plan 5-hour and weekly allowance.",links:[{label:"Usage",href:"https://platform.minimax.io/console/plan"},{label:"Docs",href:"https://platform.minimax.io/docs/token-plan/intro"}]},{id:"cursor",description:"Cursor membership detected locally, plus usage totals from an exported dashboard capture.",links:[{label:"Usage",href:"https://cursor.com/dashboard/usage"},{label:"Manage plan",href:"https://cursor.com/dashboard/billing"}]}],He={cloudflare:[{label:"Dashboard",href:"https://dash.cloudflare.com/"},{label:"Billing",href:"https://dash.cloudflare.com/?to=/:account/billing"}],vercel:[{label:"Dashboard",href:"https://vercel.com/dashboard"},{label:"Billing",href:"https://vercel.com/account/billing"}],exe:[{label:"VMs",href:"https://exe.dev/"},{label:"Billing",href:"https://exe.dev/user/billing"},{label:"Docs",href:"https://exe.dev/docs/what-is-exe"}]},ze={exe:{category:"Agent compute",description:"Persistent VMs for remote Scout agents and isolated workloads."},cloudflare:{category:"Edge platform",description:"Workers, networking, and edge infrastructure available for deployment."},vercel:{category:"App hosting",description:"Projects, preview environments, and production deployments."}};function Qe({provider:s}){return e.jsx("span",{className:`hs-cloud-mark hs-cloud-mark--${s}`,"aria-hidden":"true",children:s==="exe"?e.jsx("img",{src:"https://exe.dev/apple-touch-icon.png",alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx("svg",{viewBox:"0 0 24 24",focusable:"false",children:s==="cloudflare"?e.jsx("path",{d:"M16.5088 16.8447c.1475-.5068.0908-.9707-.1553-1.3154-.2246-.3164-.6045-.499-1.0615-.5205l-8.6592-.1123a.1559.1559 0 0 1-.1333-.0713c-.0283-.042-.0351-.0986-.021-.1553.0278-.084.1123-.1484.2036-.1562l8.7359-.1123c1.0351-.0489 2.1601-.8868 2.5537-1.9136l.499-1.3013c.0215-.0561.0293-.1128.0147-.168-.5625-2.5463-2.835-4.4453-5.5499-4.4453-2.5039 0-4.6284 1.6177-5.3876 3.8614-.4927-.3658-1.1187-.5625-1.794-.499-1.2026.119-2.1665 1.083-2.2861 2.2856-.0283.31-.0069.6128.0635.894C1.5683 13.171 0 14.7754 0 16.752c0 .1748.0142.3515.0352.5273.0141.083.0844.1475.1689.1475h15.9814c.0909 0 .1758-.0645.2032-.1553l.12-.4268Zm2.7568-5.5634c-.0771 0-.1611 0-.2383.0112-.0566 0-.1054.0415-.127.0976l-.3378 1.1744c-.1475.5068-.0918.9707.1543 1.3164.2256.3164.6055.498 1.0625.5195l1.8437.1133c.0557 0 .1055.0263.1329.0703.0283.043.0351.1074.0214.1562-.0283.084-.1132.1485-.204.1553l-1.921.1123c-1.041.0488-2.1582.8867-2.5527 1.914l-.1406.3585c-.0283.0713.0215.1416.0986.1416h6.5977c.0771 0 .1474-.0489.169-.126.1122-.4082.1757-.837.1757-1.2803 0-2.6025-2.125-4.727-4.7344-4.727"}):e.jsx("path",{d:"m12 1.608 12 20.784H0Z"})})})}function F(s){const n=(s??"").trim().toLowerCase();return n?n.includes("claude")?"claude":n.includes("codex")?"codex":n.includes("cursor")?"cursor":n.includes("kimi")||n.includes("moonshot")?"kimi":n.includes("minimax")?"minimax":n.includes("github")?"github":n.replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown":"unknown"}function P(s){return Be[s]??pe(s)}function We(s){switch(s){case"weekly":return"7d";case"req/h":return"1h";default:return s||"quota"}}function I(s){return s.windows&&s.windows.length>0?s.windows:[{label:We(s.unitLabel),fill:s.fill,usedLabel:s.usedLabel,capLabel:s.capLabel,unitLabel:s.unitLabel,resetAt:s.resetAt}]}function Ve(s){return s.capLabel==="100%"&&s.usedLabel.endsWith("%")?s.usedLabel:`${s.usedLabel}/${s.capLabel}`}function re(s){return s>=.9?"err":s>=.75?"warn":"ok"}function Ke(s,n=30){const a=s??[];if(a.length<=n)return a;if(n<=1)return[a[a.length-1]];const t=(a.length-1)/(n-1);return Array.from({length:n},(i,o)=>a[Math.round(o*t)])}function H(s){const n=Math.floor((s-Date.now())/1e3),a=n<0,t=Math.abs(n);let i;if(t>=86400){const o=Math.floor(t/86400),r=Math.floor(t%86400/3600);i=r>0?`${o}d ${r}h`:`${o}d`}else if(t>=3600){const o=Math.floor(t/3600),r=Math.floor(t%3600/60);i=r>0?`${o}h ${r}m`:`${o}h`}else i=`${Math.max(1,Math.floor(t/60))}m`;return a?`stale ${i}`:i}function Xe(s){if(!s)return null;const n=S(s.capturedAt);if(n)return n;if(s.kind!=="quota")return null;const a=I(s).reduce((t,i)=>{const o=S(i.capturedAt);return Math.max(t??0,o??0)||t},null);return a||I(s).flatMap(t=>t.history??[]).reduce((t,i)=>{const o=S(i.capturedAt);return Math.max(t??0,o??0)||t},null)}function Ze({provider:s,onImported:n}){const[a,t]=m.useState(!1),[i,o]=m.useState(""),[r,c]=m.useState(!1),[l,h]=m.useState(null),u=`hs-${s}-dashboard-capture`,d=P(s);if(!a)return e.jsxs("button",{type:"button",className:"hs-dashboard-capture-trigger",onClick:()=>t(!0),children:[e.jsx(Fe,{size:12,"aria-hidden":"true"}),"Import dashboard"]});const p=async x=>{if(x.preventDefault(),!(!i.trim()||r)){c(!0),h(null);try{await Z("/api/service-budgets/dashboard-import",{method:"POST",body:JSON.stringify({provider:s,text:i})}),o(""),h("Usage snapshot imported."),await n()}catch(v){h(v instanceof Error?v.message:String(v))}finally{c(!1)}}};return e.jsxs("form",{className:"hs-dashboard-capture",onSubmit:x=>{p(x)},children:[e.jsxs("label",{htmlFor:u,children:[d," usage snapshot"]}),e.jsxs("p",{children:[s==="cursor"?"Paste the exported Usage CSV or copied usage table.":"Copy the signed-in Usage panel and paste it here."," ","Scout keeps only normalized totals, not this text."]}),e.jsx("textarea",{id:u,value:i,onChange:x=>o(x.target.value),maxLength:128*1024,rows:5,placeholder:s==="cursor"?"Date (UTC),Type,Model,Tokens,Cost…":"Weekly SuperGrok… Limit · 12% used · Resets…","aria-describedby":l?`${u}-message`:void 0}),l?e.jsx("span",{id:`${u}-message`,className:"hs-dashboard-capture-message",role:"status",children:l}):null,e.jsxs("div",{className:"hs-dashboard-capture-actions",children:[e.jsx("button",{type:"button",onClick:()=>{t(!1),h(null)},disabled:r,children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!i.trim()||r,children:r?"Importing…":"Use snapshot"})]})]})}function Je(s){const n=new Map(s.map(a=>[F(a.id),a]));return ie.map(({id:a})=>({id:a,label:P(a),gauge:n.get(a)??null}))}function Ye({points:s}){const n=Ke(s);return n.length===0?e.jsx("span",{className:"hs-history hs-history-empty",children:"live"}):e.jsx("span",{className:"hs-history","aria-label":`${n.length} budget samples`,children:n.map((a,t)=>{const i=Math.max(.06,Math.min(1,a.fill));return e.jsx("span",{className:`hs-history-bar hs-history-bar--${re(a.fill)}`,style:{height:`${Math.round(i*100)}%`},title:`${O(a.capturedAt)||"unknown"} ${a.usedLabel}`},`${a.capturedAt}:${t}`)})})}function es({gauge:s,window:n}){const a=Math.max(0,Math.min(100,Math.round(n.fill*100))),t=100-a,i=re(n.fill),o=Number.isFinite(n.resetAt)?new Date(n.resetAt).toISOString():void 0;return e.jsxs("div",{className:"hs-subscription-window",children:[e.jsxs("div",{className:"hs-subscription-window-head",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"hs-subscription-window-label",children:[n.label," window"]}),e.jsxs("strong",{className:`hs-subscription-usage hs-subscription-usage--${i}`,children:[a,"% used"]})]}),e.jsxs("div",{className:"hs-subscription-remaining",children:[e.jsxs("strong",{children:[t,"%"]}),e.jsx("span",{children:"available"})]})]}),e.jsx("div",{className:"hs-subscription-meter",role:"progressbar","aria-label":`${s.label} ${n.label} usage`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,children:e.jsx("span",{className:`hs-subscription-meter-fill hs-subscription-meter-fill--${i}`,style:{width:`${a}%`}})}),e.jsxs("div",{className:"hs-subscription-window-meta",children:[e.jsxs("span",{children:[Ve(n)," ",n.unitLabel==="quota"?"quota":n.unitLabel]}),e.jsxs("span",{children:["resets in ",H(n.resetAt),o?e.jsx("time",{dateTime:o,title:O(n.resetAt)||void 0,children:` · ${O(n.resetAt)||""}`}):null]})]}),e.jsx(Ye,{points:n.history})]})}function ss(){return e.jsxs("div",{className:"hs-subscription-loading","aria-hidden":"true",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--label"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--value"}),e.jsx("span",{className:"hs-loading-meter"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--meta"}),e.jsx("span",{className:"hs-loading-history"})]})}function as(s,n,a){const t=s.flatMap(i=>{if(i.kind!=="quota")return[];const o=I(i).map(r=>{const c=S(r.capturedAt??i.capturedAt),l=Math.round(Math.max(0,Math.min(1,r.fill))*1e3)/10;return{label:r.label,usedPercent:l,percentRemaining:Math.round((100-l)*10)/10,windowMs:r.windowMs??null,resetAt:S(r.resetAt),resetIn:Number.isFinite(r.resetAt)?H(r.resetAt):"",freshness:{ageMs:c?Math.max(0,a-c):null,label:c?J(c)||"now":"unknown"}}});return[{id:F(i.id),label:P(F(i.id)),plan:i.plan??null,windows:o}]});return{generatedAt:n,generatedAtLocal:O(n)||"now",providers:t}}function U(s){switch(s){case"underused":return"usage trails elapsed time";case"on_track":return"usage tracks elapsed time";case"ahead":return"usage exceeds elapsed time";default:return"pace unknown"}}function A(s){return Ne(s)}function z({text:s,label:n="Copy rule"}){const[a,t]=m.useState("idle");m.useEffect(()=>{if(a==="idle")return;const o=window.setTimeout(()=>t("idle"),1800);return()=>window.clearTimeout(o)},[a]);const i=m.useCallback(async()=>{if(typeof navigator>"u"||!navigator.clipboard){t("failed");return}try{await navigator.clipboard.writeText(s),t("copied")}catch{t("failed")}},[s]);return e.jsx("button",{type:"button",className:"hs-advisor-dispatch-copy",onClick:()=>{i()},"aria-live":"polite","aria-atomic":"true",children:a==="copied"?"Copied!":a==="failed"?"Copy failed":n})}function G(s,n){return!!(s.quotaRisk&&n&&!n.quotaRisk&&se(n.quota)&&n.route.providerId!==s.route.providerId)}function oe(s){return s.minimumRemainingPercent===null?"quota unknown":`${s.minimumRemainingPercent}% minimum remaining`}function ts(s){switch(s){case"use_now":return"Use now";case"available":return"Available";case"use_deliberately":return"Use deliberately";case"probe_first":return"Probe first";case"conserve":return"Conserve"}}function le({providerLabel:s,quota:n}){return n.windows.length===0?e.jsxs("div",{className:"hs-advisor-no-quota",children:[e.jsx("strong",{children:"No quota telemetry"}),e.jsx("span",{children:"Use one bounded ask as a canary before scaling this route."})]}):e.jsx("div",{className:"hs-advisor-windows",children:n.windows.map(a=>{const t=Math.max(0,Math.min(100,a.usedPercent)),i=a.elapsedPercent===null?null:Math.max(0,Math.min(100,a.elapsedPercent)),o=i===null?"elapsed time unavailable":`${i}% of the window elapsed`,r=a.projectedUsedPercent===null?"projection unavailable":`${a.projectedUsedPercent}% projected at reset`;return e.jsxs("div",{className:"hs-advisor-window",children:[e.jsxs("div",{className:"hs-advisor-window-head",children:[e.jsx("strong",{children:a.label}),e.jsxs("span",{children:[a.usedPercent,"% used"]}),e.jsx("span",{children:U(a.status)})]}),e.jsxs("div",{className:"hs-advisor-window-meter",role:"progressbar","aria-label":`${s} ${a.label} usage`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(t),"aria-valuetext":`${a.usedPercent}% used; ${o}; ${r}; ${U(a.status)}`,children:[e.jsx("span",{className:`hs-advisor-window-fill hs-advisor-window-fill--${a.status}`,style:{width:`${t}%`}}),i!==null?e.jsx("span",{className:"hs-advisor-window-now",style:{left:`${i}%`},title:`${i}% of the window has elapsed`,"aria-hidden":"true"}):null]}),e.jsxs("div",{className:"hs-advisor-window-meta",children:[e.jsxs("span",{children:[a.percentRemaining,"% available"]}),e.jsx("span",{children:r}),e.jsx("span",{children:a.resetIn?`resets in ${a.resetIn}`:"reset unknown"})]})]},a.label)})})}function ce({assignment:s,selected:n,onSelect:a}){return e.jsxs("button",{type:"button",className:"hs-advisor-role","data-selected":n?"true":void 0,onClick:a,"aria-pressed":n,children:[e.jsx("span",{className:"hs-advisor-role-mark",children:e.jsx(L,{harness:s.route.harness,size:25,title:null})}),e.jsxs("span",{className:"hs-advisor-role-copy",children:[e.jsx("strong",{children:s.roleLabel}),e.jsx("span",{children:s.modelLabel}),e.jsxs("small",{children:[s.route.profile?`profile ${s.route.profile}`:s.route.harness," · Fit $",s.fit]})]}),e.jsx("span",{className:`hs-advisor-role-tag ${s.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:s.quotaRisk?`⚠️ ${s.quota.minimumRemainingPercent!==null?`${s.quota.minimumRemainingPercent}%`:"Risk"}`:s.fit>=100?"Primary":`Fit ${s.fit}`})]})}function ns({map:s}){const[n,a]=m.useState("implementation"),t=s.assignments.find(r=>r.role===n)??s.assignments[0];if(!t)return null;const i=B(t.route),o=t.alternatives.find(r=>G(t,r));return e.jsxs("div",{className:"hs-advisor-layout",children:[e.jsx("nav",{className:"hs-advisor-roles","aria-label":"Work roles",children:s.assignments.map(r=>e.jsx(ce,{assignment:r,selected:r.role===t.role,onSelect:()=>a(r.role)},r.role))}),e.jsxs("article",{className:"hs-advisor-detail","aria-live":"polite",children:[e.jsxs("header",{className:"hs-advisor-detail-head",children:[e.jsxs("div",{className:"hs-advisor-model",children:[e.jsx(L,{harness:t.route.harness,size:26,title:null}),e.jsxs("div",{children:[e.jsxs("span",{children:[t.roleLabel," · Role Routing"]}),e.jsx("h4",{children:t.modelLabel}),e.jsx("code",{children:A(t.route)})]})]}),e.jsx("span",{className:`hs-advisor-fit-badge ${t.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:t.quotaRisk?"⚠️ Quota Risk · Failover Active":`Primary Route · Fit ${t.fit}`})]}),t.quotaRisk?e.jsxs("div",{className:"hs-advisor-quota-alert",role:"alert",children:[e.jsxs("div",{className:"hs-advisor-quota-alert-head",children:[e.jsx("span",{className:"hs-advisor-quota-alert-badge",children:"⚠️ Quota Risk"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Quota Exhaustion Imminent · Elevated to Primary Concern"}),e.jsx("p",{children:t.quotaRiskMessage??`${t.quota.providerLabel} quota is near capacity.`})]})]}),e.jsx("div",{className:"hs-advisor-quota-alert-action",children:o?e.jsxs("span",{children:["Failover to ",e.jsx("strong",{children:o.label})," to move work off the constrained provider."]}):e.jsx("span",{children:"No quota-safe cross-provider fallback is currently available; keep the task bounded or wait for reset."})})]}):null,e.jsxs("div",{className:"hs-advisor-task-hero",children:[e.jsxs("div",{className:"hs-advisor-task-hero-head",children:[e.jsx("h5",{children:"Task Objective"}),e.jsx("span",{children:"Cognitive Strategy"})]}),e.jsx("p",{children:t.objective}),e.jsxs("small",{children:[e.jsx("strong",{children:"Execution Rationale:"})," ",t.taskRationale]})]}),e.jsxs("div",{className:"hs-advisor-assessment",children:[e.jsxs("section",{children:[e.jsx("h5",{children:"Strengths for this task"}),e.jsx("p",{children:t.capability})]}),e.jsxs("section",{children:[e.jsx("h5",{children:"Watchouts & Guardrails"}),e.jsx("p",{children:t.caution})]})]}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Dispatch rule"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:i}),e.jsx(z,{text:i,label:"Copy rule"})]})]}),e.jsxs("section",{className:"hs-advisor-ladder",children:[e.jsx("h5",{children:"Failover ladder"}),e.jsxs("div",{className:"hs-advisor-ladder-nodes",children:[e.jsxs("div",{className:`hs-advisor-ladder-node ${t.quotaRisk?"hs-advisor-ladder-node--primary hs-advisor-ladder-node--risk":"hs-advisor-ladder-node--primary"}`,children:[e.jsx("span",{className:"hs-advisor-ladder-badge",children:t.quotaRisk?"⚠️ Primary (Quota Risk)":"Primary"}),e.jsxs("div",{className:"hs-advisor-ladder-body",children:[e.jsx("strong",{children:t.modelLabel}),e.jsx("code",{children:A(t.route)}),e.jsx("small",{children:t.quotaRisk?`Exhaustion risk (${t.quota.minimumRemainingPercent}% remaining) · ${t.taskRationale}`:`Initial execution target · ${t.taskRationale}`})]})]}),t.alternatives.map((r,c)=>{const l=G(t,r);return e.jsxs("div",{className:`hs-advisor-ladder-node ${l?"hs-advisor-ladder-node--fallback-rec":""}`,children:[e.jsx("span",{className:"hs-advisor-ladder-badge",children:l?"⭐️ Quota-safe fallback":c===0?"Secondary":"Tertiary"}),e.jsxs("div",{className:"hs-advisor-ladder-body",children:[e.jsx("strong",{children:r.label}),e.jsx("code",{children:A(r.route)}),e.jsx("small",{children:l?`Moves work off ${t.quota.providerLabel} · ${r.taskRationale}`:r.quotaRisk?`Also quota constrained; use only if operationally necessary · ${r.taskRationale}`:`Fallback if ${t.modelLabel} encounters rate limits or errors · ${r.taskRationale}`})]})]},k(r.route))})]})]}),e.jsxs("section",{className:"hs-advisor-quota-secondary",children:[e.jsxs("div",{className:"hs-advisor-quota-secondary-head",children:[e.jsxs("h5",{children:["Provider Telemetry ",t.quotaRisk?"(Active Constraint)":"(Secondary)"]}),e.jsxs("span",{children:[t.quota.providerLabel,t.quota.plan?` · ${t.quota.plan}`:""]})]}),e.jsxs("div",{className:"hs-advisor-quota-compact-bar",children:[e.jsxs("span",{children:["Allowance: ",e.jsx("strong",{children:oe(t.quota)})]}),e.jsxs("span",{children:["Pacing: ",e.jsx("strong",{children:U(t.quota.pacing)})]}),e.jsxs("span",{children:["Telemetry: ",e.jsx("strong",{children:t.quota.confidence})]}),t.quota.nextResetIn?e.jsxs("span",{children:["Next reset: ",e.jsx("strong",{children:t.quota.nextResetIn})]}):null]}),t.quotaRisk?e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(le,{providerLabel:t.quota.providerLabel,quota:t.quota})}):null]})]})]})}function is({models:s}){const n=s.find(r=>r.modelLabel==="GPT-5.6 Sol")??s[0],[a,t]=m.useState(()=>n?k(n.route):""),i=s.find(r=>k(r.route)===a)??n;if(!i)return null;const o=B(i.route);return e.jsxs("div",{className:"hs-model-guide-layout",children:[e.jsx("nav",{className:"hs-model-guide-list","aria-label":"Model Fleet",children:s.map(r=>{const c=k(r.route);return e.jsxs("button",{type:"button",className:"hs-model-guide-item","data-selected":c===k(i.route)?"true":void 0,"aria-pressed":c===k(i.route),onClick:()=>t(c),children:[e.jsx("span",{className:"hs-model-guide-mark",children:e.jsx(L,{harness:r.route.harness,size:23,title:null})}),e.jsxs("span",{className:"hs-model-guide-item-copy",children:[e.jsx("strong",{children:r.modelLabel}),e.jsxs("span",{children:[r.quota.providerLabel," · ",r.route.profile?`profile ${r.route.profile}`:r.route.harness]})]}),e.jsx("span",{className:`hs-advisor-role-tag ${r.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:r.quotaRisk?"⚠️ Conserve":ts(r.guidance)})]},c)})}),e.jsxs("article",{className:"hs-model-guide-detail","aria-live":"polite",children:[e.jsxs("header",{className:"hs-advisor-detail-head",children:[e.jsxs("div",{className:"hs-advisor-model",children:[e.jsx(L,{harness:i.route.harness,size:25,title:null}),e.jsxs("div",{children:[e.jsxs("span",{children:[i.quota.providerLabel,i.quota.plan?` · ${i.quota.plan}`:""]}),e.jsx("h4",{children:i.modelLabel}),e.jsx("code",{children:A(i.route)})]})]}),e.jsx("span",{className:`hs-advisor-fit-badge ${i.quotaRisk?"hs-advisor-role-tag--risk":""}`,children:i.quotaRisk?"⚠️ Quota Risk · Conserve":i.roles.length>0?`${i.roles.length} Assigned Roles`:"Model Fleet"})]}),i.quotaRisk?e.jsx("div",{className:"hs-advisor-quota-alert",role:"alert",children:e.jsxs("div",{className:"hs-advisor-quota-alert-head",children:[e.jsx("span",{className:"hs-advisor-quota-alert-badge",children:"⚠️ Quota Risk"}),e.jsxs("div",{children:[e.jsx("strong",{children:"High Quota Depletion · Conserve Model"}),e.jsxs("p",{children:[i.quota.providerLabel," allowance is near capacity (",i.quota.minimumRemainingPercent,"% remaining). Conserve this model for essential high-fit tasks."]})]})]})}):null,e.jsxs("div",{className:"hs-model-guide-roles",children:[e.jsx("strong",{children:"Assigned task roles"}),e.jsx("div",{className:"hs-model-guide-role-chips",children:i.roles.map(r=>e.jsx("span",{className:"hs-model-guide-role-chip",children:r.label},r.role))})]}),e.jsxs("div",{className:"hs-advisor-assessment",children:[e.jsxs("section",{children:[e.jsx("h5",{children:"Strengths & Cognitive Profile"}),e.jsx("p",{children:i.strengths.join(" ")})]}),e.jsxs("section",{children:[e.jsx("h5",{children:"Watchouts & Guardrails"}),e.jsx("p",{children:i.cautions.join(" ")})]})]}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Direct dispatch"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:o}),e.jsx(z,{text:o,label:"Copy command"})]})]}),e.jsxs("section",{className:"hs-advisor-quota-secondary",children:[e.jsxs("div",{className:"hs-advisor-quota-secondary-head",children:[e.jsxs("h5",{children:["Provider Telemetry ",i.quotaRisk?"(Active Constraint)":"(Secondary)"]}),e.jsxs("span",{children:[i.quota.providerLabel,i.quota.plan?` · ${i.quota.plan}`:""]})]}),e.jsxs("div",{className:"hs-advisor-quota-compact-bar",children:[e.jsxs("span",{children:["Allowance: ",e.jsx("strong",{children:oe(i.quota)})]}),e.jsxs("span",{children:["Pacing: ",e.jsx("strong",{children:U(i.quota.pacing)})]}),e.jsxs("span",{children:["Telemetry: ",e.jsx("strong",{children:i.quota.confidence})]}),i.quota.nextResetIn?e.jsxs("span",{children:["Next reset: ",e.jsx("strong",{children:i.quota.nextResetIn})]}):null]}),i.quotaRisk?e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(le,{providerLabel:i.quota.providerLabel,quota:i.quota})}):null]})]})]})}function rs({assignments:s}){const[n,a]=m.useState("implementation"),[t,i]=m.useState({}),o=s.find(d=>d.role===n)??s[0];if(!o)return null;const r=[{label:o.modelLabel,route:o.route,capability:o.capability,taskRationale:o.taskRationale,quota:o.quota,quotaRisk:o.quotaRisk},...o.alternatives.map(d=>({label:d.label,route:d.route,capability:d.capability,taskRationale:d.taskRationale,quota:d.quota,quotaRisk:d.quotaRisk}))],c=t[o.role],l=c?c.flatMap(d=>{const p=r.find(x=>k(x.route)===d);return p?[p]:[]}):r,h=d=>{const p=l.map(x=>k(x.route));i(x=>({...x,[o.role]:[d,...p.filter(v=>v!==d)]}))},u=B(l[0].route);return e.jsxs("div",{className:"hs-cascade-layout",children:[e.jsx("nav",{className:"hs-advisor-roles","aria-label":"Cascade roles",children:s.map(d=>e.jsx(ce,{assignment:d,selected:d.role===o.role,onSelect:()=>a(d.role)},d.role))}),e.jsxs("article",{className:"hs-cascade-editor",children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsxs("span",{children:[o.roleLabel," · Failover Hierarchy"]}),e.jsx("h4",{children:"Task Escalation Sequence"}),e.jsx("p",{children:"Hierarchical fallback sequence when models encounter rate limits, timeouts, or task complexity thresholds."})]}),c?e.jsx("button",{type:"button",onClick:()=>i(d=>{const p={...d};return delete p[o.role],p}),children:"Reset suggested order"}):e.jsx("span",{children:"Default policy"})]}),e.jsx("ol",{className:"hs-cascade-workflow",children:l.map((d,p)=>{const x=k(d.route),v=p>0&&G(l[0],d),f=p===0?"Primary Route":p===1?"Secondary Fallback":"Tertiary Fallback",g=p===0?d.quotaRisk?`Initial target (⚠️ Quota Risk: ${d.quota.minimumRemainingPercent}% remaining) · ${d.taskRationale}`:`Initial execution target · ${d.taskRationale}`:p===1?v?`⭐️ Quota-safe route off ${l[0].quota.providerLabel} · ${d.taskRationale}`:`Triggered if primary encounters rate limits, errors, or complexity threshold · ${d.taskRationale}`:`Emergency baseline fallback · ${d.taskRationale}`;return e.jsxs("li",{className:"hs-cascade-node",children:[e.jsx("span",{className:"hs-cascade-node-index",children:p+1}),e.jsxs("div",{className:"hs-cascade-node-main",children:[e.jsx("span",{children:f}),e.jsx("strong",{children:d.label}),e.jsx("code",{children:A(d.route)}),e.jsx("p",{children:d.capability}),e.jsx("small",{children:g})]}),e.jsxs("div",{className:"hs-cascade-node-side",children:[e.jsx("em",{className:d.quotaRisk?"hs-advisor-tone--warn":"",children:d.quota.minimumRemainingPercent===null?"quota unknown":`${d.quota.minimumRemainingPercent}% quota remaining`}),p>0?e.jsx("button",{type:"button",onClick:()=>h(x),children:"Make primary"}):null]})]},`${o.role}:${x}`)})}),e.jsxs("section",{className:"hs-advisor-dispatch",children:[e.jsx("h5",{children:"Primary dispatch command"}),e.jsxs("div",{className:"hs-advisor-dispatch-snippet",children:[e.jsx("code",{children:u}),e.jsx(z,{text:u,label:"Copy primary command"})]})]})]})]})}function os({map:s,loading:n,bias:a,onBiasChange:t}){const[i,o]=m.useState("tasks"),r={tasks:"Task-first model routing: Map each role to the optimal cognitive profile and failover ladder.",models:"Model fleet inventory: Inspect cognitive strengths, guardrails, and assigned roles across all models.",cascades:"Failover & escalation rules: Review and customize the task escalation sequence for each role."};return e.jsxs("section",{className:"hs-advisor","aria-labelledby":"hs-orchestrator-map-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-advisor-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-orchestrator-map-title",children:"Orchestrator map"}),e.jsx("p",{children:r[i]})]}),e.jsxs("div",{className:"hs-advisor-head-tools",children:[e.jsx("span",{className:"hs-section-meta",children:n?"refreshing inputs":"advisory · no dispatch"}),e.jsxs("label",{className:"hs-routing-bias",children:[e.jsx("span",{children:"Routing bias"}),e.jsx("input",{type:"range",min:0,max:M.length-1,step:1,value:M.findIndex(c=>c.value===a),"aria-valuetext":M.find(c=>c.value===a)?.label,onChange:c=>{const l=M[Number(c.target.value)];l&&t(l.value)}}),e.jsx("small",{"aria-hidden":"true",children:M.map(c=>e.jsx("i",{"data-active":c.value===a?"true":void 0,children:c.label},c.value))})]})]})]}),e.jsx("div",{className:"hs-routing-angles",role:"group","aria-label":"Orchestrator map angle",children:[["tasks","Task map"],["models","Model fleet"],["cascades","Cascades"]].map(([c,l])=>e.jsx("button",{type:"button","aria-pressed":i===c,onClick:()=>o(c),children:l},c))}),i==="tasks"?e.jsx(ns,{map:s}):null,i==="models"?e.jsx(is,{models:s.models}):null,i==="cascades"?e.jsx(rs,{assignments:s.assignments}):null]})}function ls({rows:s,loading:n,onImported:a}){const t=ie.map(l=>({provider:l,row:s.find(h=>h.id===l.id)??null})),i=t.filter(({row:l})=>l?.gauge).length,o=t.filter(({row:l})=>l?.gauge?.kind==="quota").length,r=t.filter(({row:l})=>l?.gauge?.kind==="quota"&&l.gauge.plan||l?.gauge?.kind==="status").length,c=t.flatMap(({row:l})=>l?.gauge?.kind==="quota"?I(l.gauge):[]).map(l=>l.resetAt).filter(l=>l>Date.now()).sort((l,h)=>l-h)[0];return e.jsxs("section",{className:"hs-subscriptions","aria-labelledby":"hs-subscriptions-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-subscriptions-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-subscriptions-title",children:"Subscriptions"}),e.jsx("p",{children:"Plans, remaining allowance, reset windows, and the fastest path to each provider dashboard."})]}),e.jsxs("div",{className:"hs-subscription-summary","aria-label":"Subscription feed summary",children:[e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":i})," detected"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":o})," usage feeds"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":r})," plans named"]}),e.jsxs("span",{children:[e.jsx("strong",{children:n?"—":c?H(c):"-"})," next reset"]})]})]}),e.jsx("div",{className:"hs-subscription-grid",children:t.map(({provider:l,row:h})=>{const u=h?.gauge??null,d=n&&!u,p=d?"loading":u?"connected":"missing",x=u?.kind==="quota"?u.plan:u?.kind==="status"?u.statusLabel:null,v=Xe(u),f=u?.kind==="quota"?"Usage connected":u?.kind==="status"?u.detailLabel||"Subscription detected":d?"Checking":"Not detected";return e.jsxs("article",{className:`hs-subscription-card hs-subscription-card--${p}`,children:[e.jsxs("header",{className:"hs-subscription-card-head",children:[e.jsxs("div",{className:"hs-subscription-provider",children:[e.jsx(L,{harness:l.id,size:18,title:null,className:"hs-subscription-mark"}),e.jsxs("div",{children:[e.jsx("h4",{children:P(l.id)}),e.jsx("span",{children:d?"Checking local plan…":x||"Plan not reported"})]})]}),e.jsx("span",{className:`hs-subscription-state hs-subscription-state--${p}`,children:f})]}),e.jsx("p",{className:"hs-subscription-description",children:l.description}),d?e.jsx(ss,{}):u?.kind==="quota"?e.jsx("div",{className:"hs-subscription-windows",children:I(u).map(g=>e.jsx(es,{gauge:u,window:g},`${l.id}:${g.label}`))}):u?.kind==="status"?e.jsxs("div",{className:"hs-subscription-status-detail",children:[e.jsx("strong",{children:u.statusLabel}),e.jsx("span",{children:u.detailLabel||"Subscription detected locally. Open the provider dashboard for live usage."})]}):e.jsxs("div",{className:"hs-subscription-missing",children:[e.jsx("strong",{children:"No local subscription feed yet"}),e.jsx("span",{children:"Open the provider locally, then refresh Scout."})]}),l.id==="cursor"||l.id==="grok"&&u?.kind!=="quota"?e.jsx(Ze,{provider:l.id,onImported:a}):null,e.jsxs("footer",{className:"hs-subscription-footer",children:[e.jsxs("span",{children:[d?"checking local feed":v?`updated ${J(v)||"now"}`:u?"detected locally":"waiting for provider data",u?.source?` · ${u.source}`:""]}),e.jsx("nav",{"aria-label":`${P(l.id)} quick links`,children:l.links.map(g=>e.jsxs("a",{href:g.href,target:"_blank",rel:"noreferrer",children:[g.label,e.jsx(Y,{size:11,"aria-hidden":"true"})]},g.href))})]})]},l.id)})})]})}function cs({accounts:s,loading:n}){return s.length===0&&!n?null:e.jsxs("section",{className:"hs-cloud-accounts","aria-labelledby":"hs-cloud-accounts-title","aria-busy":n,children:[e.jsxs("div",{className:"hs-section-head hs-cloud-accounts-head",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"hs-cloud-accounts-title",children:"Cloud accounts"}),e.jsx("p",{children:"Infrastructure available to Scout for deployment and agent compute."})]}),e.jsx("span",{className:"hs-section-meta",children:n?"checking accounts":`${s.length} connected`})]}),e.jsxs("div",{className:"hs-cloud-grid",children:[n&&s.length===0?Array.from({length:3},(a,t)=>e.jsxs("article",{className:"hs-cloud-card hs-cloud-card--loading","aria-hidden":"true",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsx("span",{className:"hs-loading-mark"}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-title"})]}),e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-copy"}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsx("span",{className:"hs-loading-line hs-loading-line--cloud-meta"}),e.jsx("span",{className:"hs-loading-actions"})]})]},t)):null,s.map(a=>{const t=ze[a.id];return e.jsxs("article",{className:"hs-cloud-card",children:[e.jsxs("header",{className:"hs-cloud-card-head",children:[e.jsxs("div",{className:"hs-cloud-identity",children:[e.jsx(Qe,{provider:a.id}),e.jsxs("div",{children:[e.jsx("span",{className:"hs-cloud-category",children:t.category}),e.jsx("h4",{children:a.label})]})]}),e.jsx("span",{className:"hs-subscription-state hs-subscription-state--connected",children:a.statusLabel})]}),e.jsx("p",{className:"hs-cloud-description",children:t.description}),e.jsxs("footer",{className:"hs-cloud-card-footer",children:[e.jsxs("span",{className:"hs-cloud-connection",children:[e.jsx("span",{className:"hs-cloud-dot","aria-hidden":"true"}),a.detailLabel]}),e.jsx("nav",{"aria-label":`${a.label} quick links`,children:He[a.id].map(i=>e.jsxs("a",{href:i.href,target:"_blank",rel:"noreferrer",children:[i.label,e.jsx(Y,{size:11,"aria-hidden":"true"})]},i.href))})]})]},a.id)})]})]})}function ra({navigate:s}){const{route:n}=ge(),a=fe(n),[t]=m.useState(()=>me("/api/service-budgets",Ge)),[i,o]=m.useState(t?.gauges??[]),[r,c]=m.useState(t?.cloudAccounts??[]),[l,h]=m.useState("budget"),[u,d]=m.useState(()=>S(t?.generatedAt)??Date.now()),[p,x]=m.useState("balanced"),[v,f]=m.useState(t===null),[g,q]=m.useState(!1),[T,Q]=m.useState(null),_=m.useRef(0),W=m.useRef(t!==null),R=m.useCallback(async(y=!1,C=!1)=>{const E=++_.current;C&&!W.current&&f(!0),q(!0),Q(null);try{const w=await Z(`/api/service-budgets${y?"?refresh=1":""}`);if(E!==_.current)return;W.current=!0,o(w.gauges??[]),d(S(w.generatedAt)??Date.now()),c(w.cloudAccounts??[])}catch(w){E===_.current&&Q(w instanceof Error?w.message:String(w))}finally{E===_.current&&(f(!1),q(!1))}},[]);m.useEffect(()=>{let y=!1,C;return R(!1,!0).then(()=>{y||(C=window.setTimeout(()=>{R(!0)},600))}),()=>{y=!0,C!==void 0&&window.clearTimeout(C)}},[R]),m.useEffect(()=>{const y=window.setInterval(()=>{R(!1)},3e4);return()=>window.clearInterval(y)},[R]);const de=m.useMemo(()=>Je(i),[i]),ue=m.useMemo(()=>{const y=Date.now();return we(as(i,u,y),{now:y,bias:p})},[u,p,i]),he=xe();return e.jsxs("div",{className:"s-ops",children:[he?e.jsx("div",{className:"s-ops-header",children:e.jsx(be,{activeRoute:{view:"harnesses",...a?{machineId:a}:{}},navigate:s})}):null,e.jsx("div",{className:"s-ops-body hs-body",children:e.jsxs("div",{className:"hs-page",children:[e.jsxs("header",{className:"hs-page-head",children:[e.jsxs("div",{className:"hs-title-group",children:[e.jsx("span",{className:"hs-kicker",children:"ops / provider central"}),e.jsx("h2",{children:"Agent Providers"}),e.jsx("p",{children:l==="budget"?"See what you pay for, how much remains, and where to use it.":"Map each kind of work to a model and provider route using live quota posture."})]}),e.jsxs("div",{className:"hs-page-actions",children:[e.jsxs("div",{className:"hs-view-switch",role:"group","aria-label":"Provider view",children:[e.jsx("button",{type:"button","aria-pressed":l==="budget",onClick:()=>h("budget"),children:"Budget"}),e.jsx("button",{type:"button","aria-pressed":l==="routing",onClick:()=>h("routing"),children:"Routing"})]}),e.jsxs("button",{type:"button",className:"hs-refresh",disabled:g,onClick:()=>{R(!0)},children:[e.jsx(ve,{size:14,className:g?"hs-refresh-icon-spinning":"","aria-hidden":"true"}),e.jsx("span",{children:g?"Refreshing":"Refresh"})]})]})]}),T&&e.jsxs("div",{className:"hs-error",role:"status","aria-live":"polite",children:["refresh: ",T]}),l==="budget"?e.jsxs("div",{id:"hs-budget-view",className:"hs-provider-view",children:[e.jsx(ls,{rows:de,loading:v,onImported:()=>R(!1)}),e.jsx(cs,{accounts:r,loading:v})]}):e.jsx("div",{id:"hs-routing-view",className:"hs-provider-view",children:e.jsx(os,{map:ue,loading:v,bias:p,onBiasChange:x})})]})})]})}export{ra as HarnessesScreen};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,j as e}from"./index-
|
|
1
|
+
import{r as d,j as e}from"./index-DvLtl7rV.js";import{L as K,u as X}from"./chunk-YOZR3KYS-DwHPHa6f.js";import{c as Q}from"./clipboard-e3fSpeo7.js";import{e as A}from"./terminal-sessions-BQ6t92tJ.js";import{a as C}from"./api-Co9aQ2Jw.js";import{H as D}from"./HarnessMark-B979GCSB.js";import{T as H}from"./terminal-9GRS_Qdc.js";import{R as V}from"./refresh-cw-DMxGzDwn.js";import{C as Z}from"./check-ofKUE8yH.js";import{C as ee}from"./copy-CWWAJ75H.js";import{E as G}from"./eye-BRyD0jno.js";import{c as te}from"./createLucideIcon-DezKXSG2.js";import{X as se}from"./x-CAbNespN.js";const ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],J=te("crosshair",ne);async function re(){return C("/api/terminal-hosts")}async function ae(t,s){return C(`/api/terminal-hosts/${encodeURIComponent(t)}/sessions`,{method:"POST",body:JSON.stringify(s)})}let $=null,O=null;function ie(){return $?Promise.resolve($):(O??=re().then(t=>($=t,t)).finally(()=>{O=null}),O)}function Ae(){const[t,s]=d.useState($);return d.useEffect(()=>{if(t)return;let n=!1;return ie().then(a=>{n||s(a)}).catch(()=>{}),()=>{n=!0}},[t]),{hosts:t?.hosts??[],preferredHostId:t?.preferredHostId??null,loaded:t!==null}}async function le(t){return(await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/topology`)).topology}async function F(t,s){await C(`/api/terminal-hosts/herdr/sessions/${encodeURIComponent(t)}/focus`,{method:"POST",body:JSON.stringify({target:s})})}async function Y(t,s,n=48){const a=new URLSearchParams({backend:"herdr",sessionName:t,paneId:s,lines:String(n)}),i=await C(`/api/terminal-sessions/peek?${a.toString()}`);return i.available?{body:i.body,reason:null}:{body:null,reason:i.reason??"No preview available."}}const oe=3e3;function ce(t,s,n={}){const a=n.enabled??!0,i=n.lines??48,c=n.pollMs??oe,[p,m]=d.useState(null),[u,o]=d.useState(0);return d.useEffect(()=>{if(!t||!s||!a)return;let l=!1;m(null);const b=()=>{Y(t,s,i).then(h=>{l||m(h)}).catch(h=>{if(l)return;const r=h instanceof Error?h.message:String(h);m(g=>({body:g?.body??null,reason:r}))})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},c);return()=>{l=!0,window.clearInterval(j)}},[t,s,i,a,c,u]),{body:p?.body??null,reason:p?.reason??null,loading:p===null,refresh:()=>o(l=>l+1)}}const de=15e3;function ue(t,s,n={}){const a=n.enabled??!0,i=n.lines??6,c=n.pollMs??de,[p,m]=d.useState({}),u=s.join(`
|
|
2
2
|
`);return d.useEffect(()=>{const o=u?u.split(`
|
|
3
3
|
`):[];if(!t||!a||o.length===0)return;let l=!1;const b=()=>{Promise.all(o.map(async h=>{try{const r=await Y(t,h,i);return[h,r.body]}catch{return[h,void 0]}})).then(h=>{l||m(r=>{const g={};for(const[S,k]of h)g[S]=k===void 0?r[S]??null:k;return g})})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},c);return()=>{l=!0,window.clearInterval(j)}},[t,u,i,a,c]),p}const he=3e3;function pe(t,s={}){const n=s.enabled??!0,a=s.pollMs??he,[i,c]=d.useState(null),[p,m]=d.useState(null),[u,o]=d.useState(0);return d.useEffect(()=>{if(!t||!n)return;let l=!1;const b=()=>{le(t).then(h=>{l||(c(h),m(null))}).catch(h=>{l||m(h instanceof Error?h.message:String(h))})};b();const j=window.setInterval(()=>{document.visibilityState!=="hidden"&&b()},a);return()=>{l=!0,window.clearInterval(j)}},[t,n,a,u]),{topology:i,error:p,refresh:()=>o(l=>l+1)}}const me={column:"status",direction:"desc"},z=[{id:"pane",label:"Pane",initialDirection:"asc"},{id:"harness",label:"Harness",initialDirection:"asc"},{id:"status",label:"Status",initialDirection:"desc"},{id:"directory",label:"Directory",initialDirection:"asc"},{id:"tab",label:"Tab",initialDirection:"asc"},{id:"drift",label:"Drift",initialDirection:"desc"},{id:"output",label:"Last output",initialDirection:"asc"}];function U(t){switch(t){case"working":return 4;case"blocked":return 3;case"idle":return 2;case"done":return 1;case"unknown":return 0}}function T(t){return t.label??t.paneId}function M(t){return t.foregroundCwd??t.cwd??""}function R(t){return t.scroll?.offsetFromBottom??null}function L(t){if(!t)return null;const n=t.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,"").split(`
|
|
4
4
|
`);for(let a=n.length-1;a>=0;a-=1){const i=n[a].trim();if(i)return i}return null}function N(t,s){return t.localeCompare(s,void 0,{numeric:!0,sensitivity:"base"})}function be(t,s){const n=s.direction==="asc"?1:-1;return[...t].sort((a,i)=>{const c=fe(a,i,s.column);if(c!==0)return c;const p=xe(a,i,s.column)*n;return p!==0?p:N(T(a.pane),T(i.pane))})}function fe(t,s,n){const a=p=>n==="drift"?R(p.pane):n==="output"?L(p.output):!0,i=a(t),c=a(s);return i===null&&c===null?0:i===null?1:c===null?-1:0}function xe(t,s,n){switch(n){case"pane":return N(T(t.pane),T(s.pane));case"harness":return N(t.pane.agent??"",s.pane.agent??"");case"status":return U(t.pane.agentStatus)-U(s.pane.agentStatus);case"directory":return N(M(t.pane),M(s.pane));case"tab":return N(t.tabLabel,s.tabLabel);case"drift":return B(R(t.pane),R(s.pane));case"output":return B(L(t.output),L(s.output))}}function B(t,s){return t===null&&s===null?0:t===null?-1:s===null?1:typeof t=="string"&&typeof s=="string"?N(t,s):Number(t)-Number(s)}function je(t,s){if(t.column===s)return{column:s,direction:t.direction==="asc"?"desc":"asc"};const n=z.find(a=>a.id===s)?.initialDirection??"asc";return{column:s,direction:n}}const ye="openscout.herdr.pane-table-sort.v1";function W(t){return{view:"terminal",terminalBackend:"herdr",terminalAgent:"shell",terminalTabId:`herdr-${t}`,terminalSessionName:t}}function ge({sessionName:t,navigate:s}){const{topology:n,error:a,refresh:i}=pe(t),[c,p]=d.useState(null),[m,u]=d.useState(null),[o,l]=d.useState("idle"),[b,j]=d.useState(null),h=t==="default"?"herdr":`herdr session attach ${t}`,r=n?.running??!1,g=d.useCallback(()=>{l("starting"),j(null),ae("herdr",{sessionName:t}).then(()=>{l("idle"),i()}).catch(y=>{l("failed"),j(y instanceof Error?y.message:String(y))})},[t,i]),S=d.useCallback(()=>{s(W(t))},[s,t]),k=d.useCallback(y=>{F(t,y.terminalId??y.paneId).catch(()=>{}),s(W(t))},[s,t]);return e.jsxs("div",{className:"s-term s-herdr",children:[e.jsxs("header",{className:"s-herdr-header",children:[e.jsxs("div",{className:"s-herdr-title",children:[e.jsx("span",{className:"s-herdr-mark",children:e.jsx(H,{size:16,strokeWidth:1.8})}),e.jsx("strong",{children:t}),e.jsx("span",{className:`s-herdr-state ${r?"s-herdr-state--live":""}`,children:n?r?"running":"stopped":"loading"})]}),e.jsxs("div",{className:"s-herdr-actions",children:[r&&e.jsxs("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:S,title:"Open a live web terminal attached to this session",children:[e.jsx(K,{size:13,strokeWidth:1.8}),"Open terminal"]}),e.jsx(we,{command:h}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:i,title:"Refresh","aria-label":"Refresh",children:e.jsx(V,{size:14,strokeWidth:1.8})})]})]}),a&&e.jsx("div",{className:"s-herdr-error",children:a}),n&&!r&&e.jsxs("div",{className:"s-herdr-empty",children:[e.jsx(H,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:"This herdr session is stopped."}),e.jsx("span",{children:"The session still exists — herdr sessions are persistent. Start it and the projection fills in."}),e.jsx("button",{type:"button",className:"s-term-workspace-action s-term-workspace-action--primary",onClick:g,disabled:o==="starting",children:o==="starting"?"Starting…":"Start it"}),b&&e.jsx("code",{children:b})]}),n&&r&&n.workspaces.length===0&&e.jsxs("div",{className:"s-herdr-empty",children:[e.jsx(H,{size:22,strokeWidth:1.5}),e.jsx("strong",{children:"No workspaces yet."}),e.jsx("span",{children:"Open this session in herdr to create one — layout is herdr's job, Scout just watches."})]}),n&&r&&n.workspaces.length>0&&(()=>{const y=n.workspaces.flatMap(f=>f.tabs.map(x=>({workspace:f,tab:x})));if(y.length===0)return null;const v=n.workspaces.find(f=>f.focused)?.activeTabId??n.workspaces[0]?.activeTabId??null,E=y.find(f=>f.tab.tabId===c)??y.find(f=>f.tab.tabId===v)??y[0],{workspace:w,tab:I}=E,q=f=>{p(f),u(null)};return e.jsxs("section",{className:"s-herdr-workspace",children:[e.jsxs("div",{className:"s-herdr-workspace-head",children:[e.jsx("span",{className:"s-herdr-workspace-label",children:w.label??w.workspaceId}),e.jsx(_,{status:w.agentStatus})]}),e.jsx("div",{className:"s-herdr-tabs",role:"tablist",children:y.map(({workspace:f,tab:x})=>e.jsxs("button",{type:"button",role:"tab","aria-selected":x.tabId===I.tabId,className:`s-herdr-tab ${x.tabId===I.tabId?"s-herdr-tab--active":""}`,title:`${f.label??f.workspaceId} · ${x.label??x.tabId}`,onClick:()=>q(x.tabId),children:[e.jsx(P,{status:x.agentStatus}),e.jsx("span",{children:x.label??`Tab ${x.number??""}`}),e.jsx(Ne,{tab:x}),e.jsx("span",{className:"s-herdr-tab-count",children:x.panes.length})]},x.tabId))}),I.layout&&e.jsx(ke,{tab:I,diveInPaneId:m,onEnterPane:k,onToggleDiveIn:f=>u(x=>x===f?null:f)}),e.jsx(ve,{sessionName:t,tab:I,onEnterPane:k}),m&&(()=>{const f=I.panes.find(x=>x.paneId===m);return f?e.jsx(Se,{sessionName:t,pane:f,onClose:()=>u(null)}):null})()]})})()]})}function ke({tab:t,diveInPaneId:s,onEnterPane:n,onToggleDiveIn:a}){const i=t.layout;if(!i)return null;const{area:c}=i,p=new Map(t.panes.map(u=>[u.paneId,u])),m=`${c.width} / ${Math.max(c.height*2,1)}`;return e.jsxs("div",{className:"s-herdr-layout-window",children:[e.jsxs("div",{className:"s-herdr-layout-titlebar",children:[e.jsxs("span",{className:"s-herdr-layout-lights","aria-hidden":"true",children:[e.jsx("i",{}),e.jsx("i",{}),e.jsx("i",{})]}),e.jsxs("span",{className:"s-herdr-layout-title",children:[t.label??`Tab ${t.number??""}`," — ",i.panes.length," ",i.panes.length===1?"pane":"panes"]}),e.jsx("span",{className:"s-herdr-layout-hint",children:"click a pane to enter"})]}),e.jsx("div",{className:"s-herdr-layout",style:{aspectRatio:m},role:"group","aria-label":`Layout of ${t.label??t.tabId}`,children:i.panes.map(u=>{const o=p.get(u.paneId),{rect:l}=u,b={left:`${(l.x-c.x)/c.width*100}%`,top:`${(l.y-c.y)/c.height*100}%`,width:`${l.width/c.width*100}%`,height:`${l.height/c.height*100}%`},j=o?.paneId===s;return e.jsxs("div",{role:"button",tabIndex:0,className:`s-herdr-layout-pane ${u.focused?"s-herdr-layout-pane--focused":""}`,style:b,onClick:()=>o&&n(o),onKeyDown:h=>{o&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),n(o))},title:o?`Enter ${o.label??o.paneId} — focus it and open the web terminal`:u.paneId,children:[e.jsxs("span",{className:"s-herdr-layout-pane-head",children:[o&&e.jsx(P,{status:o.agentStatus}),o?.agent&&e.jsx(D,{harness:o.agent,size:12,className:"s-herdr-agent-mark"}),e.jsx("strong",{className:"s-herdr-pane-label",children:o?.label??u.paneId})]}),o?.foregroundCwd&&e.jsx("span",{className:"s-herdr-cwd",children:A(o.foregroundCwd)}),o&&e.jsx("button",{type:"button",className:`s-herdr-layout-pane-peek ${j?"s-herdr-layout-pane-peek--active":""}`,onClick:h=>{h.stopPropagation(),a(o.paneId)},title:j?"Close the live view":"Watch this pane live","aria-label":j?"Close the live view":"Watch this pane live","aria-pressed":j,children:e.jsx(G,{size:13,strokeWidth:1.8})})]},u.paneId)})})]})}function ve({sessionName:t,tab:s,onEnterPane:n}){const[a,i]=X(ye,me),[c,p]=d.useState(null),[m,u]=d.useState(null),o=d.useMemo(()=>s.panes.map(r=>r.paneId),[s.panes]),l=ue(t,o,{lines:6}),b=s.label??`Tab ${s.number??""}`,j=d.useMemo(()=>be(s.panes.map(r=>({pane:r,tabLabel:b,output:l[r.paneId]??null})),a),[s.panes,b,l,a]),h=d.useCallback(r=>{u(null),F(t,r.terminalId??r.paneId).catch(g=>u(g instanceof Error?g.message:String(g)))},[t]);return e.jsxs("div",{className:"s-herdr-table-wrap",children:[e.jsxs("table",{className:"s-herdr-table","aria-label":`Panes of ${b}`,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[z.map(r=>e.jsx("th",{scope:"col","aria-sort":a.column===r.id?a.direction==="asc"?"ascending":"descending":"none",children:e.jsxs("button",{type:"button",onClick:()=>i(je(a,r.id)),children:[e.jsx("span",{children:r.label}),e.jsx("em",{"aria-hidden":"true",children:a.column===r.id?a.direction==="asc"?"▲":"▼":"·"})]})},r.id)),e.jsx("th",{scope:"col","aria-label":"Actions"})]})}),e.jsx("tbody",{children:j.map(({pane:r,tabLabel:g,output:S})=>{const k=r.paneId===c,y=L(S),v=R(r),E=M(r);return e.jsxs(d.Fragment,{children:[e.jsxs("tr",{className:r.focused?"is-focused":void 0,onClick:()=>n(r),title:`Enter ${T(r)} — focus it and open the web terminal`,children:[e.jsxs("td",{className:"s-herdr-table-pane",children:[e.jsx(P,{status:r.agentStatus}),e.jsx("strong",{title:r.paneId,children:T(r)}),r.focused&&e.jsx("span",{className:"s-herdr-focused",children:"focused in herdr"})]}),e.jsx("td",{className:"s-herdr-table-harness",children:r.agent?e.jsx("span",{title:r.agent,className:"s-herdr-table-harness-mark",children:e.jsx(D,{harness:r.agent,size:13,className:"s-herdr-agent-mark"})}):e.jsx("span",{title:"shell — no agent running",className:"s-herdr-table-harness-mark",children:e.jsx(H,{size:12,strokeWidth:1.8})})}),e.jsx("td",{children:r.agentStatus==="unknown"?"—":e.jsx(_,{status:r.agentStatus})}),e.jsx("td",{className:"s-herdr-table-dir",title:E||void 0,children:E?A(E):"—"}),e.jsx("td",{children:g}),e.jsx("td",{className:"s-herdr-table-drift",title:v===null?void 0:v===0?"Pinned to live output":`Scrolled up ${v} ${v===1?"line":"lines"} from the live edge`,children:v===null?"—":v===0?"live":`↑${v}`}),e.jsx("td",{className:"s-herdr-table-output",title:y??void 0,children:y??"—"}),e.jsxs("td",{className:"s-herdr-table-actions",children:[e.jsx("button",{type:"button",className:`s-term-icon-button${k?" is-active":""}`,onClick:w=>{w.stopPropagation(),p(I=>I===r.paneId?null:r.paneId)},title:k?"Hide the pane's last lines":"Show the pane's last lines","aria-label":k?"Hide the pane's last lines":"Show the pane's last lines","aria-pressed":k,children:e.jsx(G,{size:13,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:w=>{w.stopPropagation(),h(r)},title:"Focus this pane in the herdr client","aria-label":"Focus this pane in the herdr client",children:e.jsx(J,{size:13,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:w=>{w.stopPropagation(),n(r)},title:"Enter — focus it and open the web terminal","aria-label":"Enter — focus it and open the web terminal",children:e.jsx(K,{size:13,strokeWidth:1.8})})]})]}),k&&e.jsx("tr",{className:"s-herdr-table-expand",children:e.jsx("td",{colSpan:z.length+1,children:S?e.jsx("pre",{children:S}):e.jsx("span",{className:"s-herdr-peek-reason",children:"No output captured yet."})})})]},r.paneId)})})]}),m&&e.jsx("div",{className:"s-herdr-error",children:m})]})}function we({command:t}){const[s,n]=d.useState(!1);return e.jsxs("button",{type:"button",className:"s-herdr-attach",title:"Copy attach command — open this session in the herdr client",onClick:()=>{Q(t).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},children:[s?e.jsx(Z,{size:13,strokeWidth:2}):e.jsx(ee,{size:13,strokeWidth:1.8}),e.jsx("code",{children:t})]})}function Se({sessionName:t,pane:s,onClose:n}){const{body:a,reason:i,loading:c,refresh:p}=ce(t,s.paneId,{lines:48}),[m,u]=d.useState(null);d.useEffect(()=>{const l=b=>{b.key==="Escape"&&n()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[n]);const o=d.useCallback(()=>{u(null),F(t,s.terminalId??s.paneId).catch(l=>u(l instanceof Error?l.message:String(l)))},[t,s.terminalId,s.paneId]);return e.jsx("div",{className:"s-herdr-lightbox",onClick:n,role:"presentation",children:e.jsxs("section",{className:"s-herdr-live","aria-label":`Live view of ${s.label??s.paneId}`,onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"s-herdr-live-head",children:[e.jsx(P,{status:s.agentStatus}),s.agent&&e.jsx(D,{harness:s.agent,size:13,className:"s-herdr-agent-mark"}),e.jsx("strong",{className:"s-herdr-pane-label",children:s.label??s.paneId}),e.jsx(_,{status:s.agentStatus}),s.foregroundCwd&&e.jsx("span",{className:"s-herdr-cwd",children:A(s.foregroundCwd)}),e.jsx("span",{className:"s-herdr-pane-spacer"}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:o,title:"Focus this pane in the herdr client","aria-label":"Focus this pane in the herdr client",children:e.jsx(J,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button",onClick:p,title:"Refresh now","aria-label":"Refresh now",children:e.jsx(V,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"s-term-icon-button s-term-icon-button--danger",onClick:n,title:"Close the live view (Esc)","aria-label":"Close the live view",children:e.jsx(se,{size:14,strokeWidth:1.8})})]}),e.jsx("div",{className:"s-herdr-live-body",children:a!==null?e.jsx("pre",{children:a}):c?e.jsx("span",{className:"s-herdr-peek-reason",children:"Loading…"}):e.jsx("span",{className:"s-herdr-peek-reason",children:i??"No preview available."})}),m&&e.jsx("div",{className:"s-herdr-error",children:m})]})})}function Ie(t){return t}function P({status:t}){return e.jsx("span",{className:`s-herdr-dot s-herdr-dot--${t}`,"aria-hidden":"true"})}function _({status:t}){return t==="unknown"?null:e.jsx("span",{className:`s-herdr-badge s-herdr-badge--${t}`,children:t})}function Ne({tab:t}){const s=[...new Set(t.panes.map(n=>n.agent).filter(n=>!!n))].slice(0,4);return s.length===0?null:e.jsx("span",{className:"s-herdr-tab-marks",children:s.map(n=>e.jsx(D,{harness:n,size:11,className:"s-herdr-agent-mark"},n))})}function Te(t){return{label:t.label??`Tab ${t.number??""}`,statuses:t.panes.map(s=>s.agentStatus)}}const Fe=Object.freeze(Object.defineProperty({__proto__:null,AgentStatusBadge:_,AgentStatusDot:P,HerdrSessionScreen:ge,herdrAgentStatusLabel:Ie,herdrTabSummary:Te,herdrTerminalRoute:W},Symbol.toStringTag,{value:"Module"}));export{P as A,ge as H,pe as a,Te as b,ae as c,Fe as d,W as h,Ae as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,j as t}from"./index-CZ-05hKz.js";import{R as H}from"./refresh-cw-BRn9Oxxl.js";import{A as _}from"./activity-Bj3Hnbj3.js";import"./createLucideIcon-DXpqZP7I.js";const q=3,I=2;function W(e){return e>=.9?"err":e>=.75?"warn":"ok"}const O=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function A(e,a){const s=e-a.getTime(),c=new Date(e).toDateString()===a.toDateString(),r=new Date(e),n=String(r.getHours()).padStart(2,"0"),l=String(r.getMinutes()).padStart(2,"0"),i=s>0&&s<6*3600*1e3;return c?{label:`${n}:${l}`,imminent:i}:{label:`${O[r.getDay()]} ${n}:${l}`,imminent:i}}function G(e,a){const s=Math.floor((e-a.getTime())/1e3),c=s<0,r=Math.abs(s);let n;if(r>=86400){const l=Math.floor(r/86400),i=Math.floor(r%86400/3600);n=i>0?`${l}d ${i}h`:`${l}d`}else if(r>=3600){const l=Math.floor(r/3600),i=Math.floor(r%3600/60);n=i>0?`${l}h ${i}m`:`${l}h`}else n=`${Math.max(1,Math.floor(r/60))}m`;return c?`stale ${n}`:n}function w(e){return e.windows&&e.windows.length>0?e.windows:[{label:z(e.unitLabel),fill:e.fill,usedLabel:e.usedLabel,capLabel:e.capLabel,unitLabel:e.unitLabel,resetAt:e.resetAt}]}function z(e){switch(e){case"weekly":return"7d";case"req/h":return"1h";default:return e||"quota"}}function E(e,a){return w(e).map(s=>{const c=A(s.resetAt,a),r=G(s.resetAt,a);return`${s.label}: ${s.usedLabel} / ${s.capLabel} ${s.unitLabel} · resets ${c.label} (in ${r})`}).join(" · ")}function S(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([mhd])$/i);if(!a)return null;const s=Number(a[1]);if(!Number.isFinite(s))return null;switch(a[2]?.toLowerCase()){case"m":return s;case"h":return s*60;case"d":return s*24*60;default:return null}}function Q(e){const a=[...e].sort((r,n)=>(S(r.label)??Number.MAX_SAFE_INTEGER)-(S(n.label)??Number.MAX_SAFE_INTEGER)),s=a.find(r=>(S(r.label)??0)>=1440)??(a.length>1?a[a.length-1]:null);return{shortWindow:a.find(r=>r!==s)??null,longWindow:s}}function V(e){return e.capLabel==="100%"&&e.usedLabel.endsWith("%")?e.usedLabel:`${e.usedLabel}/${e.capLabel}`}function N(){return t.jsx("span",{className:"hd-gauge-cell hd-gauge-cell--empty",children:"—"})}function T({window:e}){if(!e)return t.jsx(N,{});const a=Math.round(e.fill*100),s=W(e.fill);return t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage",children:[t.jsx("span",{className:"hd-gauge-window-name label-xs",children:e.label}),t.jsx("span",{className:"hd-gauge-bar","aria-hidden":"true",children:t.jsx("span",{className:`hd-gauge-bar-fill hd-gauge-bar-fill--${s}`,style:{width:`${a}%`}})}),t.jsx("span",{className:"hd-gauge-window-used",children:V(e)})]})}function R({window:e,now:a,featured:s=!1}){if(!e)return t.jsx(N,{});if(s){const n=P(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset hd-gauge-reset--featured hd-gauge-reset--${n.tone}`,"aria-live":"off","aria-label":n.ariaLabel,children:[t.jsx("strong",{children:n.primary}),n.dateTime?t.jsx("time",{dateTime:n.dateTime,children:n.secondary}):t.jsx("span",{children:n.secondary})]})}const c=A(e.resetAt,a),r=G(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset${c.imminent?" hd-gauge-reset--imminent":""}`,children:["↻ ",r]})}function P(e,a){if(!Number.isFinite(e))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const s=e-a.getTime(),c=new Date(e);if(!Number.isFinite(c.getTime()))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const r=c.toISOString();if(s<=0){const u=Math.abs(s);if(u<=9e4)return{primary:"reset due",secondary:"refreshing…",ariaLabel:"Weekly reset due; refreshing usage",tone:"due",dateTime:r};const x=Math.floor(u/6e4),$=x>=60?`+${Math.floor(x/60)}h ${x%60}m`:`+${Math.max(1,x)}m`;return{primary:u<=360*6e4?"reset due":"stale",secondary:$,ariaLabel:`Weekly reset data ${$} overdue`,tone:u<=360*6e4?"due":"stale",dateTime:r}}const n=Math.floor(s/1e3),l=Math.floor(n/86400),i=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),d=n%60,h=[i,o,d].map(u=>String(u).padStart(2,"0")).join(":"),b=l>0?`${l}d ${h}`:h,m=c.toDateString()===a.toDateString(),f=c.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),g=m?`today ${f}`:`${c.toLocaleDateString([],{weekday:"short"})} ${f}`,p=l>0?`${l} ${l===1?"day":"days"} ${i} hours`:`${i} hours ${o} minutes`;return{primary:b,secondary:g,ariaLabel:`Weekly quota resets in ${p}; ${g}`,tone:s<360*6e4?"imminent":"normal",dateTime:r}}function B(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;const a=[`M ${e[0].x} ${e[0].y}`];for(let s=0;s<e.length-1;s++){const c=e[s-1]??e[s],r=e[s],n=e[s+1],l=e[s+2]??n,i=r.x+(n.x-c.x)/6,o=r.y+(n.y-c.y)/6,d=n.x-(l.x-r.x)/6,h=n.y-(l.y-r.y)/6;a.push(`C ${i} ${o}, ${d} ${h}, ${n.x} ${n.y}`)}return a.join(" ")}function U(e){const a=v.useRef(null),[s,c]=v.useState(e);return v.useLayoutEffect(()=>{const r=a.current;if(!r)return;const n=i=>{const o=Math.round(i);o>0&&c(d=>d===o?d:o)};n(r.getBoundingClientRect().width);const l=new ResizeObserver(i=>{n(i[0]?.contentRect.width??0)});return l.observe(r),()=>l.disconnect()},[]),[a,s]}function X({buckets:e}){const[a,s]=U(372),c=72,r=8,n=54,l=67,i=e.length,o=i<2||e.every(p=>p.count===0),d=Math.max(1,s-4),h={viewBox:`0 0 ${s} ${c}`,style:{width:"100%",height:c,display:"block"}};if(o)return t.jsx("div",{ref:a,className:"hd-heartrate-svg-wrap",children:t.jsx("svg",{...h,children:t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"})})});const b=d/(i-1),m=e.map((p,u)=>({x:u*b,y:n-Math.max(0,Math.min(1,p.value))*(n-r)})),f=B(m),g=`${f} L ${d} ${n} L 0 ${n} Z`;return t.jsx("div",{ref:a,className:"hd-heartrate-svg-wrap",children:t.jsxs("svg",{...h,children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"hrdFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.28"}),t.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0.0"})]})}),t.jsx("line",{x1:"0",y1:r,x2:s,y2:r,stroke:"var(--border)",opacity:"0.25"}),t.jsx("line",{x1:"0",y1:(r+n)/2,x2:s,y2:(r+n)/2,stroke:"var(--border)",opacity:"0.25"}),t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"}),t.jsx("path",{d:g,fill:"url(#hrdFill)"}),t.jsx("path",{d:f,fill:"none",stroke:"var(--accent)",strokeWidth:"1.75",strokeLinecap:"round"}),t.jsx("circle",{cx:m[i-1].x,cy:m[i-1].y,r:"3",fill:"var(--accent)"}),t.jsx("circle",{cx:m[i-1].x,cy:m[i-1].y,r:"6",fill:"var(--accent)",opacity:"0.25"}),t.jsx("text",{x:"0",y:l,fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"7d"}),t.jsx("text",{x:s/2,y:l,textAnchor:"middle",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"3d"}),t.jsx("text",{x:s,y:l,textAnchor:"end",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"now"})]})})}function K({gauge:e,now:a,onClick:s}){const c=s?"button":"span",r=s?{type:"button",onClick:s}:{};if(e.kind==="status")return t.jsxs(c,{className:`hd-gauge hd-gauge--status hd-gauge--${e.tone}${s?" hd-gauge--interactive":""}`,"aria-label":`${e.label} subscription usage`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsx("span",{className:`hd-gauge-dot hd-gauge-dot--${e.tone}`,"aria-hidden":"true"})]}),t.jsx(N,{}),t.jsx(N,{}),t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage hd-gauge-cell--status",children:[t.jsx("span",{className:"hd-gauge-window-name label-xs",children:e.windowLabel??"usage"}),t.jsx("span",{className:"hd-gauge-status",children:e.statusLabel})]}),t.jsx("span",{className:"hd-gauge-cell hd-gauge-reset",children:e.detailLabel??"quota n/a"})]});const n=w(e),{shortWindow:l,longWindow:i}=Q(n),o=W(Math.max(...n.map(h=>h.fill))),d=Math.round(Math.max(...n.map(h=>h.fill))*100);return t.jsxs(c,{className:`hd-gauge hd-gauge--${o}${s?" hd-gauge--interactive":""}`,title:E(e,a),"aria-label":`${e.label} subscription usage. ${E(e,a)}`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsxs("span",{className:`hd-gauge-pct hd-gauge-pct--${o}`,children:[d,"%"]})]}),t.jsx(T,{window:l}),t.jsx(R,{window:l,now:a}),t.jsx(T,{window:i}),t.jsx(R,{window:i,now:a,featured:!0})]})}function Y(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([kKmM])?$/u);if(!a)return 0;const s=Number(a[1]);if(!Number.isFinite(s))return 0;switch(a[2]?.toLowerCase()){case"m":return s*1e6;case"k":return s*1e3;default:return s}}function Z(e){return e.kind==="quota"?Math.max(e.fill,...w(e).map(a=>a.fill)):Y(e.statusLabel)>0?.01:0}function J(e){return e.kind==="quota"}function ee(e){return C(e).slice(0,I)}function C(e){return e.map((a,s)=>({gauge:a,index:s,score:Z(a)})).sort((a,s)=>s.score-a.score||a.index-s.index).map(({gauge:a})=>a)}function re(e){const{now:a,operatorName:s,syncLabel:c,error:r,loading:n,refreshing:l,onRefresh:i,navigate:o,heartrate:d,heartrateWindow:h,heartrateBucketLabel:b,heartrateVisibleEventThreshold:m=q,serviceGauges:f}=e,[g,p]=v.useState(!1),u=r?"err":"ok",x=f.filter(J),$=C(x),k=ee(x),y=g?$:k,F=x.length>k.length,L=d.reduce((j,D)=>j+D.count,0),M=L>=m;return t.jsxs("section",{className:"hd","aria-label":"Fleet Cockpit and Service Cluster",children:[t.jsxs("div",{className:"hd-vitals-band",children:[t.jsxs("div",{className:"hd-vitals-left",children:[t.jsx("span",{className:"label-sm hd-vitals-title",children:"Fleet Cockpit"}),s&&t.jsx("span",{className:"chip chip--neutral chip--mono chip--sm hd-vitals-callsign",children:s})]}),t.jsxs("div",{className:"hd-vitals-right",children:[r&&t.jsx("span",{className:"dot dot--warning","aria-hidden":"true"}),t.jsx("span",{className:`hd-meta hd-meta--${u}`,children:c}),t.jsx("button",{type:"button",className:"hd-refresh-btn",disabled:n||l,onClick:i,title:"Refresh status (r)","aria-label":l?"Refreshing status":"Refresh status",children:t.jsx(H,{size:11,className:l?"hd-spin":"","aria-hidden":"true"})})]})]}),(y.length>0||M)&&t.jsxs("div",{className:`hd-telemetry-grid ${M&&y.length>0?"hd-telemetry-grid--split":"hd-telemetry-grid--single"}`,children:[y.length>0&&t.jsxs("div",{className:"hd-card hd-card--quotas",children:[t.jsxs("div",{className:"hd-card-head",children:[t.jsxs("div",{className:"hd-card-head-left",children:[t.jsx("span",{className:"label-xs hd-card-title",children:"Subscriptions & Quotas"}),t.jsxs("span",{className:"chip chip--neutral chip--mono chip--sm",children:[y.length," Active"]})]}),F&&t.jsxs("button",{type:"button",className:"hd-gauge-toggle","aria-expanded":g,onClick:()=>p(j=>!j),children:["[",g?"Top 2":`All ${x.length}`,"]"]})]}),t.jsxs("div",{className:"hd-gauge-set",children:[t.jsxs("div",{className:"hd-gauge-table-head label-xs","aria-hidden":"true",children:[t.jsx("span",{children:"Service"}),t.jsx("span",{children:"Short Window"}),t.jsx("span",{children:"Resets"}),t.jsx("span",{children:"Long Window"}),t.jsx("span",{children:"Reset Countdown"})]}),y.map(j=>t.jsx("span",{className:"hd-gauge-wrap",children:t.jsx(K,{gauge:j,now:a,onClick:()=>o({view:"harnesses"})})},j.id))]})]}),M&&t.jsxs("div",{className:"hd-card hd-card--heartrate",children:[t.jsxs("div",{className:"hd-card-head",children:[t.jsxs("div",{className:"hd-card-head-left",children:[t.jsx(_,{size:12,className:"hd-heartrate-icon","aria-hidden":"true"}),t.jsx("span",{className:"label-xs hd-card-title",children:"Fleet Velocity"})]}),t.jsxs("div",{className:"hd-card-head-right",children:[t.jsxs("span",{className:"label-xs hd-card-sub",children:[h," ",b?`· ${b}`:""]}),t.jsxs("span",{className:"chip chip--working chip--mono chip--sm",children:[L," ",L===1?"Event":"Events"]})]})]}),t.jsx("div",{className:"hd-heartrate-plot-body",children:t.jsx(X,{buckets:d})})]})]})]})}export{re as default};
|
|
1
|
+
import{r as v,j as t}from"./index-DvLtl7rV.js";import{R as H}from"./refresh-cw-DMxGzDwn.js";import{A as _}from"./activity-DcrMApUY.js";import"./createLucideIcon-DezKXSG2.js";const q=3,I=2;function W(e){return e>=.9?"err":e>=.75?"warn":"ok"}const O=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function A(e,a){const s=e-a.getTime(),c=new Date(e).toDateString()===a.toDateString(),r=new Date(e),n=String(r.getHours()).padStart(2,"0"),l=String(r.getMinutes()).padStart(2,"0"),i=s>0&&s<6*3600*1e3;return c?{label:`${n}:${l}`,imminent:i}:{label:`${O[r.getDay()]} ${n}:${l}`,imminent:i}}function G(e,a){const s=Math.floor((e-a.getTime())/1e3),c=s<0,r=Math.abs(s);let n;if(r>=86400){const l=Math.floor(r/86400),i=Math.floor(r%86400/3600);n=i>0?`${l}d ${i}h`:`${l}d`}else if(r>=3600){const l=Math.floor(r/3600),i=Math.floor(r%3600/60);n=i>0?`${l}h ${i}m`:`${l}h`}else n=`${Math.max(1,Math.floor(r/60))}m`;return c?`stale ${n}`:n}function w(e){return e.windows&&e.windows.length>0?e.windows:[{label:z(e.unitLabel),fill:e.fill,usedLabel:e.usedLabel,capLabel:e.capLabel,unitLabel:e.unitLabel,resetAt:e.resetAt}]}function z(e){switch(e){case"weekly":return"7d";case"req/h":return"1h";default:return e||"quota"}}function E(e,a){return w(e).map(s=>{const c=A(s.resetAt,a),r=G(s.resetAt,a);return`${s.label}: ${s.usedLabel} / ${s.capLabel} ${s.unitLabel} · resets ${c.label} (in ${r})`}).join(" · ")}function S(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([mhd])$/i);if(!a)return null;const s=Number(a[1]);if(!Number.isFinite(s))return null;switch(a[2]?.toLowerCase()){case"m":return s;case"h":return s*60;case"d":return s*24*60;default:return null}}function Q(e){const a=[...e].sort((r,n)=>(S(r.label)??Number.MAX_SAFE_INTEGER)-(S(n.label)??Number.MAX_SAFE_INTEGER)),s=a.find(r=>(S(r.label)??0)>=1440)??(a.length>1?a[a.length-1]:null);return{shortWindow:a.find(r=>r!==s)??null,longWindow:s}}function V(e){return e.capLabel==="100%"&&e.usedLabel.endsWith("%")?e.usedLabel:`${e.usedLabel}/${e.capLabel}`}function N(){return t.jsx("span",{className:"hd-gauge-cell hd-gauge-cell--empty",children:"—"})}function T({window:e}){if(!e)return t.jsx(N,{});const a=Math.round(e.fill*100),s=W(e.fill);return t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage",children:[t.jsx("span",{className:"hd-gauge-window-name label-xs",children:e.label}),t.jsx("span",{className:"hd-gauge-bar","aria-hidden":"true",children:t.jsx("span",{className:`hd-gauge-bar-fill hd-gauge-bar-fill--${s}`,style:{width:`${a}%`}})}),t.jsx("span",{className:"hd-gauge-window-used",children:V(e)})]})}function R({window:e,now:a,featured:s=!1}){if(!e)return t.jsx(N,{});if(s){const n=P(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset hd-gauge-reset--featured hd-gauge-reset--${n.tone}`,"aria-live":"off","aria-label":n.ariaLabel,children:[t.jsx("strong",{children:n.primary}),n.dateTime?t.jsx("time",{dateTime:n.dateTime,children:n.secondary}):t.jsx("span",{children:n.secondary})]})}const c=A(e.resetAt,a),r=G(e.resetAt,a);return t.jsxs("span",{className:`hd-gauge-cell hd-gauge-reset${c.imminent?" hd-gauge-reset--imminent":""}`,children:["↻ ",r]})}function P(e,a){if(!Number.isFinite(e))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const s=e-a.getTime(),c=new Date(e);if(!Number.isFinite(c.getTime()))return{primary:"—",secondary:"unknown",ariaLabel:"Weekly reset time unknown",tone:"stale"};const r=c.toISOString();if(s<=0){const u=Math.abs(s);if(u<=9e4)return{primary:"reset due",secondary:"refreshing…",ariaLabel:"Weekly reset due; refreshing usage",tone:"due",dateTime:r};const x=Math.floor(u/6e4),$=x>=60?`+${Math.floor(x/60)}h ${x%60}m`:`+${Math.max(1,x)}m`;return{primary:u<=360*6e4?"reset due":"stale",secondary:$,ariaLabel:`Weekly reset data ${$} overdue`,tone:u<=360*6e4?"due":"stale",dateTime:r}}const n=Math.floor(s/1e3),l=Math.floor(n/86400),i=Math.floor(n%86400/3600),o=Math.floor(n%3600/60),d=n%60,h=[i,o,d].map(u=>String(u).padStart(2,"0")).join(":"),b=l>0?`${l}d ${h}`:h,m=c.toDateString()===a.toDateString(),f=c.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),g=m?`today ${f}`:`${c.toLocaleDateString([],{weekday:"short"})} ${f}`,p=l>0?`${l} ${l===1?"day":"days"} ${i} hours`:`${i} hours ${o} minutes`;return{primary:b,secondary:g,ariaLabel:`Weekly quota resets in ${p}; ${g}`,tone:s<360*6e4?"imminent":"normal",dateTime:r}}function B(e){if(e.length===0)return"";if(e.length===1)return`M ${e[0].x} ${e[0].y}`;const a=[`M ${e[0].x} ${e[0].y}`];for(let s=0;s<e.length-1;s++){const c=e[s-1]??e[s],r=e[s],n=e[s+1],l=e[s+2]??n,i=r.x+(n.x-c.x)/6,o=r.y+(n.y-c.y)/6,d=n.x-(l.x-r.x)/6,h=n.y-(l.y-r.y)/6;a.push(`C ${i} ${o}, ${d} ${h}, ${n.x} ${n.y}`)}return a.join(" ")}function U(e){const a=v.useRef(null),[s,c]=v.useState(e);return v.useLayoutEffect(()=>{const r=a.current;if(!r)return;const n=i=>{const o=Math.round(i);o>0&&c(d=>d===o?d:o)};n(r.getBoundingClientRect().width);const l=new ResizeObserver(i=>{n(i[0]?.contentRect.width??0)});return l.observe(r),()=>l.disconnect()},[]),[a,s]}function X({buckets:e}){const[a,s]=U(372),c=72,r=8,n=54,l=67,i=e.length,o=i<2||e.every(p=>p.count===0),d=Math.max(1,s-4),h={viewBox:`0 0 ${s} ${c}`,style:{width:"100%",height:c,display:"block"}};if(o)return t.jsx("div",{ref:a,className:"hd-heartrate-svg-wrap",children:t.jsx("svg",{...h,children:t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"})})});const b=d/(i-1),m=e.map((p,u)=>({x:u*b,y:n-Math.max(0,Math.min(1,p.value))*(n-r)})),f=B(m),g=`${f} L ${d} ${n} L 0 ${n} Z`;return t.jsx("div",{ref:a,className:"hd-heartrate-svg-wrap",children:t.jsxs("svg",{...h,children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"hrdFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:"var(--accent)",stopOpacity:"0.28"}),t.jsx("stop",{offset:"100%",stopColor:"var(--accent)",stopOpacity:"0.0"})]})}),t.jsx("line",{x1:"0",y1:r,x2:s,y2:r,stroke:"var(--border)",opacity:"0.25"}),t.jsx("line",{x1:"0",y1:(r+n)/2,x2:s,y2:(r+n)/2,stroke:"var(--border)",opacity:"0.25"}),t.jsx("line",{x1:"0",y1:n,x2:s,y2:n,stroke:"var(--border)"}),t.jsx("path",{d:g,fill:"url(#hrdFill)"}),t.jsx("path",{d:f,fill:"none",stroke:"var(--accent)",strokeWidth:"1.75",strokeLinecap:"round"}),t.jsx("circle",{cx:m[i-1].x,cy:m[i-1].y,r:"3",fill:"var(--accent)"}),t.jsx("circle",{cx:m[i-1].x,cy:m[i-1].y,r:"6",fill:"var(--accent)",opacity:"0.25"}),t.jsx("text",{x:"0",y:l,fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"7d"}),t.jsx("text",{x:s/2,y:l,textAnchor:"middle",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"3d"}),t.jsx("text",{x:s,y:l,textAnchor:"end",fill:"var(--dim)",fontSize:"9",fontFamily:"var(--font-mono)",children:"now"})]})})}function K({gauge:e,now:a,onClick:s}){const c=s?"button":"span",r=s?{type:"button",onClick:s}:{};if(e.kind==="status")return t.jsxs(c,{className:`hd-gauge hd-gauge--status hd-gauge--${e.tone}${s?" hd-gauge--interactive":""}`,"aria-label":`${e.label} subscription usage`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsx("span",{className:`hd-gauge-dot hd-gauge-dot--${e.tone}`,"aria-hidden":"true"})]}),t.jsx(N,{}),t.jsx(N,{}),t.jsxs("span",{className:"hd-gauge-cell hd-gauge-cell--usage hd-gauge-cell--status",children:[t.jsx("span",{className:"hd-gauge-window-name label-xs",children:e.windowLabel??"usage"}),t.jsx("span",{className:"hd-gauge-status",children:e.statusLabel})]}),t.jsx("span",{className:"hd-gauge-cell hd-gauge-reset",children:e.detailLabel??"quota n/a"})]});const n=w(e),{shortWindow:l,longWindow:i}=Q(n),o=W(Math.max(...n.map(h=>h.fill))),d=Math.round(Math.max(...n.map(h=>h.fill))*100);return t.jsxs(c,{className:`hd-gauge hd-gauge--${o}${s?" hd-gauge--interactive":""}`,title:E(e,a),"aria-label":`${e.label} subscription usage. ${E(e,a)}`,...r,children:[t.jsxs("span",{className:"hd-gauge-head",children:[t.jsx("span",{className:"hd-gauge-label",children:e.label}),t.jsxs("span",{className:`hd-gauge-pct hd-gauge-pct--${o}`,children:[d,"%"]})]}),t.jsx(T,{window:l}),t.jsx(R,{window:l,now:a}),t.jsx(T,{window:i}),t.jsx(R,{window:i,now:a,featured:!0})]})}function Y(e){const a=e.trim().match(/^(\d+(?:\.\d+)?)([kKmM])?$/u);if(!a)return 0;const s=Number(a[1]);if(!Number.isFinite(s))return 0;switch(a[2]?.toLowerCase()){case"m":return s*1e6;case"k":return s*1e3;default:return s}}function Z(e){return e.kind==="quota"?Math.max(e.fill,...w(e).map(a=>a.fill)):Y(e.statusLabel)>0?.01:0}function J(e){return e.kind==="quota"}function ee(e){return C(e).slice(0,I)}function C(e){return e.map((a,s)=>({gauge:a,index:s,score:Z(a)})).sort((a,s)=>s.score-a.score||a.index-s.index).map(({gauge:a})=>a)}function re(e){const{now:a,operatorName:s,syncLabel:c,error:r,loading:n,refreshing:l,onRefresh:i,navigate:o,heartrate:d,heartrateWindow:h,heartrateBucketLabel:b,heartrateVisibleEventThreshold:m=q,serviceGauges:f}=e,[g,p]=v.useState(!1),u=r?"err":"ok",x=f.filter(J),$=C(x),k=ee(x),y=g?$:k,F=x.length>k.length,L=d.reduce((j,D)=>j+D.count,0),M=L>=m;return t.jsxs("section",{className:"hd","aria-label":"Fleet Cockpit and Service Cluster",children:[t.jsxs("div",{className:"hd-vitals-band",children:[t.jsxs("div",{className:"hd-vitals-left",children:[t.jsx("span",{className:"label-sm hd-vitals-title",children:"Fleet Cockpit"}),s&&t.jsx("span",{className:"chip chip--neutral chip--mono chip--sm hd-vitals-callsign",children:s})]}),t.jsxs("div",{className:"hd-vitals-right",children:[r&&t.jsx("span",{className:"dot dot--warning","aria-hidden":"true"}),t.jsx("span",{className:`hd-meta hd-meta--${u}`,children:c}),t.jsx("button",{type:"button",className:"hd-refresh-btn",disabled:n||l,onClick:i,title:"Refresh status (r)","aria-label":l?"Refreshing status":"Refresh status",children:t.jsx(H,{size:11,className:l?"hd-spin":"","aria-hidden":"true"})})]})]}),(y.length>0||M)&&t.jsxs("div",{className:`hd-telemetry-grid ${M&&y.length>0?"hd-telemetry-grid--split":"hd-telemetry-grid--single"}`,children:[y.length>0&&t.jsxs("div",{className:"hd-card hd-card--quotas",children:[t.jsxs("div",{className:"hd-card-head",children:[t.jsxs("div",{className:"hd-card-head-left",children:[t.jsx("span",{className:"label-xs hd-card-title",children:"Subscriptions & Quotas"}),t.jsxs("span",{className:"chip chip--neutral chip--mono chip--sm",children:[y.length," Active"]})]}),F&&t.jsxs("button",{type:"button",className:"hd-gauge-toggle","aria-expanded":g,onClick:()=>p(j=>!j),children:["[",g?"Top 2":`All ${x.length}`,"]"]})]}),t.jsxs("div",{className:"hd-gauge-set",children:[t.jsxs("div",{className:"hd-gauge-table-head label-xs","aria-hidden":"true",children:[t.jsx("span",{children:"Service"}),t.jsx("span",{children:"Short Window"}),t.jsx("span",{children:"Resets"}),t.jsx("span",{children:"Long Window"}),t.jsx("span",{children:"Reset Countdown"})]}),y.map(j=>t.jsx("span",{className:"hd-gauge-wrap",children:t.jsx(K,{gauge:j,now:a,onClick:()=>o({view:"harnesses"})})},j.id))]})]}),M&&t.jsxs("div",{className:"hd-card hd-card--heartrate",children:[t.jsxs("div",{className:"hd-card-head",children:[t.jsxs("div",{className:"hd-card-head-left",children:[t.jsx(_,{size:12,className:"hd-heartrate-icon","aria-hidden":"true"}),t.jsx("span",{className:"label-xs hd-card-title",children:"Fleet Velocity"})]}),t.jsxs("div",{className:"hd-card-head-right",children:[t.jsxs("span",{className:"label-xs hd-card-sub",children:[h," ",b?`· ${b}`:""]}),t.jsxs("span",{className:"chip chip--working chip--mono chip--sm",children:[L," ",L===1?"Event":"Events"]})]})]}),t.jsx("div",{className:"hd-heartrate-plot-body",children:t.jsx(X,{buckets:d})})]})]})]})}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as s}from"./index-CZ-05hKz.js";/* empty css */import{H as ds}from"./HarnessMark-D5CA5uSp.js";import{a as b}from"./api-Co9aQ2Jw.js";import{u as hs}from"./sse-CiOSzE5n.js";import{t as C}from"./time-Dhsh_2EG.js";import{C as ms}from"./compass-0_54-vz3.js";import{F as us}from"./file-text-KijGBnME.js";import{L as ps}from"./layout-grid-BrZt31QH.js";import{R as xs}from"./refresh-cw-BRn9Oxxl.js";import{A as H}from"./arrow-up-right-CCfZXPqD.js";import{C as Ns}from"./cpu-BjVis9mc.js";import{G as fs,D as js}from"./gauge-y-Xg8Mrv.js";import{c as gs}from"./createLucideIcon-DXpqZP7I.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";const bs=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],ks=gs("folder-git-2",bs),vs=.8,ws=20,F="░",T="·",Ss=["▏","▎","▍","▌","▋","▊","▉"];function ys(a,r=ws){const o=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,d=Math.round(o*100);if(o<=0)return{filled:"",rest:T.repeat(r),cells:r,percent:0};const i=o*r;let h=Math.floor(i),m=Math.round((i-h)*8);return m===8&&(h+=1,m=0),h>=r?{filled:F.repeat(r),rest:"",cells:r,percent:d}:m===0?h===0?{filled:"▏",rest:T.repeat(r-1),cells:r,percent:d}:{filled:F.repeat(h),rest:T.repeat(r-h),cells:r,percent:d}:{filled:F.repeat(h)+Ss[m-1],rest:T.repeat(r-h-1),cells:r,percent:d}}function S(a){return a.kind==="status"||typeof a.fill!="number"||!Number.isFinite(a.fill)?null:Math.min(1,Math.max(0,a.fill))}function _(a){const r=S(a);return r!==null&&r>=vs}function J(a){return S(a)===0}function $s(a){if(a===null)return{verdict:"Reading",figures:"provider budgets still arriving",showGauges:!1,near:[],unused:0,configured:0,peakPercent:null};if(a.length===0)return{verdict:"All clear",figures:"no provider budgets reported",showGauges:!1,near:[],unused:0,configured:0,peakPercent:null};const r=[...a].filter(_).sort((v,D)=>(S(D)??0)-(S(v)??0)),o=a.filter(J).length,d=a.map(S).filter(v=>v!==null),i=d.length>0?Math.round(Math.max(...d)*100):null,h=a.length-o;let m;r.length>0?m=`${r.length} near ceiling`:h===0?m="Unused":m=`Peak ${i??0}%`;const f=[r.length>0?r.map(v=>`${v.label} ${Math.round((S(v)??0)*100)}%`).join(" · "):null,`${a.length} configured`,o>0&&h>0?`${o} unused`:null].filter(Boolean).join(" · ");return{verdict:m,figures:f,showGauges:!0,near:r,unused:o,configured:a.length,peakPercent:i}}function Es(a,r){if(!a)return r||"process";if(a.includes("--append-system-prompt")){const o=a.match(/session-[a-zA-Z0-9_-]+/);return o?`${r||"harness"} (relay ${o[0]})`:`${r||"harness"} (prompted relay)`}return a.length>70?`${a.slice(0,67)}...`:a}function I(a){if(!a)return"workspace";const r=a.replace(/\/+$/,"").split("/");return r[r.length-1]||a}function Rs(a){if(!a)return;const[r,o]=a.includes("-")?a.split("-"):["0",a],d=o.split(":").map(f=>Number.parseInt(f,10));if(d.length<2||d.some(f=>!Number.isFinite(f)))return;const[i,h,m]=d.length===3?d:[0,d[0],d[1]];return((Number.parseInt(r,10)||0)*24+i)*3600+h*60+m}function Z(a){if(a<60)return`${Math.round(a)}s`;const r=Math.floor(a/60);if(r<60)return`${r}m`;const o=Math.floor(r/60),d=r%60;return o<24?d?`${o}h${String(d).padStart(2,"0")}m`:`${o}h`:`${Math.floor(o/24)}d${o%24}h`}function As(a){const r=a.split("/").filter(Boolean);return r[r.length-1]||a}const X={stalled_relay:"relay",idle_process:"process",uncommitted_branch:"branch",unresumed_session:"session"};function Ps({gauge:a}){const r=S(a),o=_(a),d=J(a),i=ys(r??0),h=r!==null,m=o?"warn":d||!h?"unused":"ok",f=d?"UNUSED":a.resetAt?`RESET ${C(a.resetAt)}`:a.statusLabel||a.usedLabel||"";return s.jsxs("div",{className:`s-host-rack-row ${o?"s-host-rack-row--warn":""} ${d||!h?"s-host-rack-row--unused":""}`,children:[s.jsx("span",{className:"s-host-rack-name font-mono",children:a.label}),s.jsxs("span",{className:`s-host-gauge s-host-gauge--${m}`,role:"meter","aria-label":h?`${a.label} ${i.percent} percent`:`${a.label} ${a.statusLabel||"no quota"}`,"aria-valuemin":h?0:void 0,"aria-valuemax":h?100:void 0,"aria-valuenow":h?i.percent:void 0,children:[s.jsx("span",{className:"s-host-gauge-chrome","aria-hidden":"true",children:"["}),s.jsx("span",{className:"s-host-gauge-fill","aria-hidden":"true",children:i.filled}),s.jsx("span",{className:"s-host-gauge-rest","aria-hidden":"true",children:i.rest}),s.jsx("span",{className:"s-host-gauge-chrome","aria-hidden":"true",children:"]"})]}),s.jsx("span",{className:`s-host-rack-right font-mono ${o?"s-host-rack-age--warn":""} ${d||!h?"s-host-rack-dim":""}`,children:h?`${i.percent}%`:"—"}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono s-host-rack-truncate",children:f})]})}function se({navigate:a,agents:r}){const[o,d]=c.useState(null),[i,h]=c.useState(null),[m,f]=c.useState(null),[v,D]=c.useState(null),[z,ss]=c.useState(null),[L,es]=c.useState(null),[O,ts]=c.useState([]),[Ms,as]=c.useState(null),[V,ns]=c.useState([]),[Ts,rs]=c.useState([]),[Is,K]=c.useState(!0),[E,W]=c.useState(!1),[Cs,os]=c.useState(Date.now()),[G,Y]=c.useState("inquiry"),[ls,Ds]=c.useState(!1),[Ls,Os]=c.useState({"q-attention":!0,"q-dropped":!0,"q-quotas":!0,"q-posture":!0}),R=c.useCallback(async(e=!1)=>{e?W(!0):K(!0);try{const[t,n,l,k,P,p,N,M,B,q]=await Promise.allSettled([b("/.host-info"),b("/api/build"),b("/api/service-budgets"),b("/api/tail/discover"),b("/api/knowledge/status"),b("/api/pairing-state"),b("/api/terminal-sessions"),b("/api/fleet"),b("/api/sessions"),b("/api/activity")]);t.status==="fulfilled"&&d(t.value),n.status==="fulfilled"&&h(n.value),l.status==="fulfilled"?f(l.value?.gauges??[]):l.status==="rejected"&&f([]),k.status==="fulfilled"&&D(k.value),P.status==="fulfilled"&&ss(P.value),p.status==="fulfilled"&&es(p.value),N.status==="fulfilled"&&N.value?.sessions&&ts(N.value.sessions),M.status==="fulfilled"&&as(M.value),B.status==="fulfilled"&&Array.isArray(B.value)&&ns(B.value),q.status==="fulfilled"&&Array.isArray(q.value)&&rs(q.value),os(Date.now())}finally{K(!1),W(!1)}},[]);c.useEffect(()=>{R()},[R]),hs(()=>{R(!0)});const x=v?.processes??[],is=ls?x:x.slice(0,5);c.useMemo(()=>{const e={};for(const t of r){const n=t.harness||"other";e[n]||(e[n]={total:0,active:0}),e[n].total+=1,t.state==="working"&&(e[n].active+=1)}for(const t of x){const n=t.harness||"other";e[n]||(e[n]={total:0,active:0}),e[n].total=Math.max(e[n].total,1),e[n].active=Math.max(e[n].active,1)}return e},[r,x]);const $=c.useMemo(()=>{const e=new Map;for(const t of r){const n=t.projectRoot||t.cwd||"unknown";e.has(n)||e.set(n,{root:n,name:I(n),agents:[],branches:new Set,processes:[]});const l=e.get(n);l.agents.push(t),t.branch&&l.branches.add(t.branch)}for(const t of x)if(t.cwd)for(const[n,l]of e.entries())(t.cwd.startsWith(n)||n.startsWith(t.cwd))&&l.processes.push(t);return Array.from(e.values())},[r,x]),w=c.useMemo(()=>{const e=$.reduce((p,N)=>p+Math.max(1,N.agents.length+N.processes.length*3),0),t=$.map(p=>{const N=Math.max(1,p.agents.length+p.processes.length*3),M=e>0?Math.round(N/e*100):0;return{...p,weight:N,percent:M,primaryBranch:Array.from(p.branches)[0]||p.name==="openscout"&&i?.gitBranch||"main"}}).sort((p,N)=>N.weight-p.weight),n=t.slice(0,5),l=t[0],k=t.slice(5),P=k.reduce((p,N)=>p+N.percent,0);return{ranked:t,topProjects:n,topProject:l,otherProjects:k,otherPercent:P,totalProjects:t.length}},[$,i]),j=c.useMemo(()=>{const e=[];for(const t of x)if(t.command&&t.command.includes("--append-system-prompt")){const n=t.command.match(/session-[a-zA-Z0-9_-]+/),l=n?n[0]:`PID ${t.pid}`;e.push({id:`relay-${t.pid}`,kind:"stalled_relay",title:l,subtitle:`Launched in ${I(t.cwd)} · PID ${t.pid} · Runtime ${t.etime||"active"}`,ageLabel:t.etime||"active",ageSeconds:Rs(t.etime),projectRoot:t.cwd||void 0,harness:t.harness,pid:t.pid,severity:"warn",actionLabel:"Tail Process",actionRoute:{view:"ops",mode:"mission"}})}i?.gitBranch&&i.gitBranch!=="main"&&e.push({id:"branch-divergence",kind:"uncommitted_branch",title:i.gitBranch,subtitle:`Local worktree is ahead with uncommitted edits on ${i.runtime?.platform||"darwin"}`,ageLabel:"Unmerged",projectRoot:"/Users/art/dev/openscout",severity:"neutral",actionLabel:"Inspect Repos",actionRoute:{view:"repos"}});for(const t of V.slice(0,4))t.lastMessageAt&&Date.now()-t.lastMessageAt>3600*1e3&&e.push({id:`session-${t.id}`,kind:"unresumed_session",title:t.title||t.id,subtitle:`Last turn recorded ${C(t.lastMessageAt)} · ${t.messageCount} messages · ${I(t.workspaceRoot)}`,ageLabel:C(t.lastMessageAt),ageSeconds:(Date.now()-t.lastMessageAt)/1e3,conversationId:t.id,projectRoot:t.workspaceRoot||void 0,harness:t.harness||void 0,severity:"info",actionLabel:"Open Chat",actionRoute:{view:"conversation",conversationId:t.id}});return e},[x,i,V]),g=c.useMemo(()=>m?.length?[...m].sort((e,t)=>(t.fill??0)-(e.fill??0))[0]:null,[m]),u=c.useMemo(()=>{const e=w.ranked;if(e.length===0)return null;const t=e[0].percent,n=w.otherProjects;return{verdict:t>=50?"Concentrated":t>=25?"Weighted":"Scattered",topPercent:t,tailPercent:w.otherPercent,tailCount:n.length,tailAgents:n.reduce((l,k)=>l+k.agents.length,0),tailProcesses:n.reduce((l,k)=>l+k.processes.length,0),aboveTen:e.filter(l=>l.percent>=10).length}},[w]),y=c.useMemo(()=>{const e=j.reduce((n,l)=>(n[l.kind]=(n[l.kind]??0)+1,n),{}),t=j.map(n=>n.ageSeconds).filter(n=>typeof n=="number").sort((n,l)=>l-n)[0];return{verdict:j.length===0?"Nothing unattended":`${j.length} unattended`,byKind:e,oldestLabel:t?Z(t):null}},[j]),U=c.useMemo(()=>$s(m),[m]),A=c.useMemo(()=>{const e=O.length,t=z?.indexedSessions??0,n=L?.trustedPeerCount??0,l=o?.brokerUrl||(o?.ports?.broker?`127.0.0.1:${o.ports.broker}`:null);return[{key:"broker",label:"broker",detail:l?[l,o?.brokerSocketPath?As(o.brokerSocketPath):null].filter(Boolean).join(" · "):"endpoint not reported",state:l?"UP":"UNKNOWN",tone:l?"ok":"unknown"},{key:"pty",label:"pty relay",detail:e>0?`${e} socket${e===1?"":"s"}`:"0 sockets · latency unmeasured",state:e>0?"ACTIVE":"IDLE",tone:e>0?"ok":"idle"},{key:"knowledge",label:"knowledge",detail:t>0?`${t.toLocaleString()} transcript${t===1?"":"s"} indexed`:"0 transcripts indexed",state:t>0?"INDEXED":"EMPTY",tone:t>0?"ok":"warn",action:t>0?void 0:{label:"Index",route:{view:"search"}}},{key:"mesh",label:"mesh",detail:n>0?`${n} trusted peer${n===1?"":"s"} · scope ${o?.advertiseScope||"mesh"}`:`no trusted peers · scope ${o?.advertiseScope||"mesh"}`,state:n>0?"PAIRED":"UNPAIRED",tone:n>0?"ok":"idle"}]},[o,O,z,L]),Q=c.useMemo(()=>{const e=A.reduce((n,l)=>(n[l.tone]=(n[l.tone]??0)+1,n),{}),t=A.filter(n=>n.tone==="warn");return{verdict:t.length>0?`${t.length} ${t.length===1?"needs":"need"} attention`:"All nominal",figures:[e.ok?`${e.ok} up`:null,e.idle?`${e.idle} idle`:null,e.warn?`${e.warn} empty`:null,e.unknown?`${e.unknown} unknown`:null].filter(Boolean).join(" · ")}},[A]);o?.nodeName||o?.hostName;const cs=i?.runtime?`${i.runtime.platform} ${i.runtime.arch} · ${i.runtime.engine} ${i.runtime.engineVersion}`:"Darwin arm64";return s.jsxs("div",{className:"s-host-view",children:[s.jsxs("header",{className:"s-host-header",children:[s.jsxs("div",{className:"s-host-header-left",children:[s.jsxs("div",{className:"s-host-header-status-line",children:[s.jsx("span",{className:"dot dot--sm dot--working dot--pulse","aria-hidden":"true"}),s.jsxs("span",{className:"label-xs s-host-mono-dim",children:["NODE: ",o?.nodeId||"local"]}),s.jsx("span",{className:"s-host-header-divider",children:"/"}),s.jsx("span",{className:"label-xs s-host-mono-dim",children:cs}),i?.gitHash&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"s-host-header-divider",children:"/"}),s.jsxs("span",{className:"label-xs s-host-mono-dim",children:["git:",i.gitHash.slice(0,7)]})]})]}),s.jsxs("h1",{className:"s-host-title",children:[s.jsx(ms,{size:22,className:"s-host-title-icon"}),s.jsx("span",{children:"Host Advisor"})]})]}),s.jsxs("div",{className:"s-host-header-right",children:[s.jsxs("div",{className:"s-host-mode-toggle",role:"group","aria-label":"Advisor Format",children:[s.jsxs("button",{type:"button",className:`s-host-mode-btn ${G==="inquiry"?"s-host-mode-btn--active":""}`,onClick:()=>Y("inquiry"),title:"Formatted Executive Inquiries & Operator Answers",children:[s.jsx(us,{size:12}),s.jsx("span",{children:"Inquiries"})]}),s.jsxs("button",{type:"button",className:`s-host-mode-btn ${G==="matrix"?"s-host-mode-btn--active":""}`,onClick:()=>Y("matrix"),title:"Compact Infrastructure Matrix",children:[s.jsx(ps,{size:12}),s.jsx("span",{children:"Matrix"})]})]}),s.jsxs("button",{type:"button",className:`btn btn--sm ${E?"btn--accent":""}`,disabled:E,onClick:()=>{R(!0)},children:[s.jsx(xs,{size:12,className:E?"s-spin":""}),s.jsx("span",{children:E?"Scanning...":"Refresh"})]})]})]}),s.jsxs("section",{className:"s-host-readouts","aria-label":"Host Readouts",children:[s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"AGENTS"}),s.jsx("span",{className:"s-host-readout-figure",children:r.length}),s.jsxs("span",{className:"label-xs s-host-readout-qual",children:[x.length," PROCESS",x.length===1?"":"ES"]})]}),s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"ROOTS"}),s.jsx("span",{className:"s-host-readout-figure",children:$.length}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:u?`TOP SHARE ${u.topPercent}%`:"NONE ACTIVE"})]}),s.jsxs("div",{className:`s-host-readout ${g&&_(g)?"s-host-readout--warn":""}`,children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"PEAK BUDGET"}),s.jsx("span",{className:"s-host-readout-figure",children:g?`${Math.round((g.fill??0)*100)}%`:"—"}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:g?`${g.label}${g.resetAt?` · RESET ${C(g.resetAt)}`:""}`:"NO PROVIDERS CONFIGURED"})]}),s.jsxs("div",{className:`s-host-readout ${j.length>0?"s-host-readout--flag":""}`,children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"UNATTENDED"}),s.jsx("span",{className:"s-host-readout-figure",children:j.length}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:y.oldestLabel?`OLDEST ${y.oldestLabel}`:"NONE OPEN"})]}),s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"MESH PEERS"}),s.jsx("span",{className:"s-host-readout-figure",children:L?.trustedPeerCount??0}),s.jsxs("span",{className:"label-xs s-host-readout-qual",children:["SCOPE ",(o?.advertiseScope||"mesh").toUpperCase()]})]})]}),G==="inquiry"?s.jsxs("div",{className:"s-host-readings","aria-label":"Host Readings",children:[s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"01 // ATTENTION"}),s.jsx("span",{className:"s-host-reading-verdict",children:u?.verdict??"No active roots"}),s.jsx("span",{className:"s-host-reading-figures",children:u?s.jsxs(s.Fragment,{children:["top ",u.topPercent,"%",s.jsx("span",{className:"s-host-sep",children:"·"}),"tail ",u.tailPercent,"%",s.jsx("span",{className:"s-host-sep",children:"·"}),u.aboveTen," root",u.aboveTen===1?"":"s"," above 10%"]}):s.jsx(s.Fragment,{children:"no agents or processes bound to a workspace"})}),s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"repos"}),children:[s.jsx("span",{children:"Repos"}),s.jsx(H,{size:10})]})]}),w.ranked.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"s-host-share-bar",children:[w.topProjects.map((e,t)=>s.jsx("div",{className:`s-host-share-seg s-host-share-seg--${Math.min(t,4)}`,style:{width:`${e.percent}%`},title:`${e.name} ${e.percent}%`,children:s.jsxs("span",{className:"s-host-share-seg-label font-mono text-2xs",children:[e.name," ",e.percent,"%"]})},e.root)),u&&u.tailCount>0&&s.jsx("div",{className:"s-host-share-seg s-host-share-seg--tail",style:{flex:1},children:s.jsxs("span",{className:"s-host-share-seg-label font-mono text-2xs",children:[u.tailCount," OTHER ROOTS — ",u.tailPercent,"%"]})})]}),s.jsxs("div",{className:"s-host-rack s-host-rack--roots",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs",children:"ROOT"}),s.jsx("span",{className:"label-xs",children:"SHARE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PCT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"AGENTS"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PROCS"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"BRANCH"})]}),w.topProjects.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:"s-host-rack-name font-mono",children:e.name}),s.jsx("span",{className:"s-host-rack-track",children:s.jsx("span",{className:"s-host-rack-fill",style:{width:`${u&&u.topPercent>0?Math.round(e.percent/u.topPercent*100):0}%`}})}),s.jsxs("span",{className:"s-host-rack-right font-mono",children:[e.percent,"%"]}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.agents.length}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.processes.length}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono s-host-rack-truncate",children:e.primaryBranch})]},e.root)),u&&u.tailCount>0&&s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--tail",children:[s.jsxs("span",{className:"s-host-rack-name font-mono",children:["tail — ",u.tailCount," roots"]}),s.jsx("span",{className:"s-host-rack-track s-host-rack-track--hatch"}),s.jsxs("span",{className:"s-host-rack-right font-mono",children:[u.tailPercent,"%"]}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:u.tailAgents}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:u.tailProcesses}),s.jsxs("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:["each below ",w.topProjects.at(-1)?.percent??0,"%"]})]})]})]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"02 // UNATTENDED"}),s.jsx("span",{className:"s-host-reading-verdict",children:y.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:j.length>0?s.jsxs(s.Fragment,{children:[y.oldestLabel&&s.jsxs(s.Fragment,{children:["oldest ",y.oldestLabel,s.jsx("span",{className:"s-host-sep",children:"·"})]}),Object.entries(y.byKind).map(([e,t])=>`${t} ${X[e]??e}`).join(" · "),s.jsx("span",{className:"s-host-sep",children:"·"}),"of ",x.length," processes"]}):s.jsx(s.Fragment,{children:"no idle relays, diverged branches or stale conversations"})})]}),j.length>0&&s.jsxs("div",{className:"s-host-rack s-host-rack--unattended",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs"}),s.jsx("span",{className:"label-xs",children:"SIGNAL"}),s.jsx("span",{className:"label-xs",children:"ROOT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"REF"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"AGE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"ACTION"})]}),j.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:`dot dot--sm ${e.severity==="warn"?"dot--warning":"dot--neutral"}`,"aria-hidden":"true"}),s.jsx("span",{className:"s-host-rack-name font-mono s-host-rack-truncate",children:e.title}),s.jsx("span",{className:"s-host-rack-dim font-mono s-host-rack-truncate",children:e.projectRoot?I(e.projectRoot):"—"}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.pid?`pid ${e.pid}`:X[e.kind]??e.kind}),s.jsx("span",{className:`s-host-rack-right font-mono s-host-rack-age ${e.severity==="warn"?"s-host-rack-age--warn":""}`,children:e.ageSeconds?Z(e.ageSeconds):e.ageLabel}),s.jsx("span",{className:"s-host-rack-right s-host-rack-actions",children:e.actionRoute&&s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>e.actionRoute&&a(e.actionRoute),children:e.actionLabel})})]},e.id))]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"03 // BUDGETS"}),s.jsx("span",{className:"s-host-reading-verdict",children:U.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:U.figures}),s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"harnesses"}),children:[s.jsx("span",{children:"Providers"}),s.jsx(H,{size:10})]})]}),U.showGauges&&m&&s.jsxs("div",{className:"s-host-rack s-host-rack--budgets",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs",children:"PROVIDER"}),s.jsx("span",{className:"label-xs",children:"GAUGE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PCT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"NOTE"})]}),m.map(e=>s.jsx(Ps,{gauge:e},e.id))]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"04 // SUBSYSTEMS"}),s.jsx("span",{className:"s-host-reading-verdict",children:Q.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:Q.figures})]}),s.jsxs("div",{className:"s-host-rack s-host-rack--subsystems",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs"}),s.jsx("span",{className:"label-xs",children:"SUBSYSTEM"}),s.jsx("span",{className:"label-xs",children:"DETAIL"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"STATE"})]}),A.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:`dot dot--sm s-host-dot--${e.tone}`,"aria-hidden":"true"}),s.jsx("span",{className:"s-host-rack-name font-mono",children:e.label}),s.jsx("span",{className:"s-host-rack-dim font-mono s-host-rack-truncate",children:e.detail}),s.jsxs("span",{className:"s-host-rack-right s-host-rack-actions",children:[e.action&&s.jsx("button",{type:"button",className:"btn btn--sm s-host-btn-accent",onClick:()=>e.action&&a(e.action.route),children:e.action.label}),s.jsx("span",{className:`chip chip--sm chip--mono s-host-state s-host-state--${e.tone}`,children:e.state})]})]},e.key))]})]})]}):s.jsxs("div",{className:"s-host-matrix-container",children:[s.jsxs("section",{className:"s-host-telemetry-grid","aria-label":"Host Telemetry Overview",children:[s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"REGISTERED AGENTS"}),s.jsx(Ns,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:r.length}),s.jsxs("span",{className:"s-host-stat-kicker",children:[x.length," background processes"]})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"SERVICE QUOTA RADAR"}),s.jsx(fs,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:g?`${Math.round((g.fill??0)*100)}%`:"Nominal"}),s.jsx("span",{className:"s-host-stat-kicker",children:"peak token consumption"})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"WORKSPACES & REPOS"}),s.jsx(ks,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:$.length}),s.jsx("span",{className:"s-host-stat-kicker",children:"registered project roots"})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"SUBSYSTEM RELAYS"}),s.jsx(js,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:O.length}),s.jsx("span",{className:"s-host-stat-kicker",children:"live terminal relays"})]})]})]}),s.jsxs("section",{className:"s-host-block","aria-label":"Active Processes",children:[s.jsx("div",{className:"s-host-block-head",children:s.jsxs("span",{className:"label-xs",children:["ACTIVE HARNESS PROCESSES (",x.length,")"]})}),s.jsx("div",{className:"s-host-table-box",children:s.jsx("div",{className:"s-host-table",children:is.map(e=>s.jsxs("div",{className:"s-host-table-row",children:[s.jsxs("div",{className:"s-host-table-cell-main",children:[s.jsx("span",{className:"dot dot--sm dot--working dot--pulse","aria-hidden":"true"}),s.jsx(ds,{harness:e.harness,size:13}),s.jsx("span",{className:"font-semibold text-xs font-mono",children:Es(e.command,e.harness)}),s.jsxs("span",{className:"chip chip--sm chip--ghost chip--mono",children:["PID ",e.pid]}),e.etime&&s.jsx("span",{className:"chip chip--sm chip--ghost chip--mono",children:e.etime})]}),s.jsx("div",{className:"s-host-table-cell-action",children:s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"ops",mode:"mission"}),children:[s.jsx("span",{children:"Tail"}),s.jsx(H,{size:10})]})})]},e.pid))})})]})]})]})}export{se as HostAdvisorView};
|
|
1
|
+
import{r as c,j as s}from"./index-DvLtl7rV.js";/* empty css */import{H as ds}from"./HarnessMark-B979GCSB.js";import{a as b}from"./api-Co9aQ2Jw.js";import{u as hs}from"./sse-CD9MMUxl.js";import{t as C}from"./time-Dhsh_2EG.js";import{C as ms}from"./compass-Dt1AMXz2.js";import{F as us}from"./file-text-CqJgwxmv.js";import{L as ps}from"./layout-grid-DOChPJdZ.js";import{R as xs}from"./refresh-cw-DMxGzDwn.js";import{A as H}from"./arrow-up-right-C6Wl-1uw.js";import{C as Ns}from"./cpu-DrqejfkB.js";import{G as fs,D as js}from"./gauge-hU--hKVP.js";import{c as gs}from"./createLucideIcon-DezKXSG2.js";import"./perf-PX8Rx0EP.js";import"./index-BWHgHrtv.js";const bs=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],ks=gs("folder-git-2",bs),vs=.8,ws=20,F="░",T="·",Ss=["▏","▎","▍","▌","▋","▊","▉"];function ys(a,r=ws){const o=Number.isFinite(a)?Math.min(1,Math.max(0,a)):0,d=Math.round(o*100);if(o<=0)return{filled:"",rest:T.repeat(r),cells:r,percent:0};const i=o*r;let h=Math.floor(i),m=Math.round((i-h)*8);return m===8&&(h+=1,m=0),h>=r?{filled:F.repeat(r),rest:"",cells:r,percent:d}:m===0?h===0?{filled:"▏",rest:T.repeat(r-1),cells:r,percent:d}:{filled:F.repeat(h),rest:T.repeat(r-h),cells:r,percent:d}:{filled:F.repeat(h)+Ss[m-1],rest:T.repeat(r-h-1),cells:r,percent:d}}function S(a){return a.kind==="status"||typeof a.fill!="number"||!Number.isFinite(a.fill)?null:Math.min(1,Math.max(0,a.fill))}function _(a){const r=S(a);return r!==null&&r>=vs}function J(a){return S(a)===0}function $s(a){if(a===null)return{verdict:"Reading",figures:"provider budgets still arriving",showGauges:!1,near:[],unused:0,configured:0,peakPercent:null};if(a.length===0)return{verdict:"All clear",figures:"no provider budgets reported",showGauges:!1,near:[],unused:0,configured:0,peakPercent:null};const r=[...a].filter(_).sort((v,D)=>(S(D)??0)-(S(v)??0)),o=a.filter(J).length,d=a.map(S).filter(v=>v!==null),i=d.length>0?Math.round(Math.max(...d)*100):null,h=a.length-o;let m;r.length>0?m=`${r.length} near ceiling`:h===0?m="Unused":m=`Peak ${i??0}%`;const f=[r.length>0?r.map(v=>`${v.label} ${Math.round((S(v)??0)*100)}%`).join(" · "):null,`${a.length} configured`,o>0&&h>0?`${o} unused`:null].filter(Boolean).join(" · ");return{verdict:m,figures:f,showGauges:!0,near:r,unused:o,configured:a.length,peakPercent:i}}function Es(a,r){if(!a)return r||"process";if(a.includes("--append-system-prompt")){const o=a.match(/session-[a-zA-Z0-9_-]+/);return o?`${r||"harness"} (relay ${o[0]})`:`${r||"harness"} (prompted relay)`}return a.length>70?`${a.slice(0,67)}...`:a}function I(a){if(!a)return"workspace";const r=a.replace(/\/+$/,"").split("/");return r[r.length-1]||a}function Rs(a){if(!a)return;const[r,o]=a.includes("-")?a.split("-"):["0",a],d=o.split(":").map(f=>Number.parseInt(f,10));if(d.length<2||d.some(f=>!Number.isFinite(f)))return;const[i,h,m]=d.length===3?d:[0,d[0],d[1]];return((Number.parseInt(r,10)||0)*24+i)*3600+h*60+m}function Z(a){if(a<60)return`${Math.round(a)}s`;const r=Math.floor(a/60);if(r<60)return`${r}m`;const o=Math.floor(r/60),d=r%60;return o<24?d?`${o}h${String(d).padStart(2,"0")}m`:`${o}h`:`${Math.floor(o/24)}d${o%24}h`}function As(a){const r=a.split("/").filter(Boolean);return r[r.length-1]||a}const X={stalled_relay:"relay",idle_process:"process",uncommitted_branch:"branch",unresumed_session:"session"};function Ps({gauge:a}){const r=S(a),o=_(a),d=J(a),i=ys(r??0),h=r!==null,m=o?"warn":d||!h?"unused":"ok",f=d?"UNUSED":a.resetAt?`RESET ${C(a.resetAt)}`:a.statusLabel||a.usedLabel||"";return s.jsxs("div",{className:`s-host-rack-row ${o?"s-host-rack-row--warn":""} ${d||!h?"s-host-rack-row--unused":""}`,children:[s.jsx("span",{className:"s-host-rack-name font-mono",children:a.label}),s.jsxs("span",{className:`s-host-gauge s-host-gauge--${m}`,role:"meter","aria-label":h?`${a.label} ${i.percent} percent`:`${a.label} ${a.statusLabel||"no quota"}`,"aria-valuemin":h?0:void 0,"aria-valuemax":h?100:void 0,"aria-valuenow":h?i.percent:void 0,children:[s.jsx("span",{className:"s-host-gauge-chrome","aria-hidden":"true",children:"["}),s.jsx("span",{className:"s-host-gauge-fill","aria-hidden":"true",children:i.filled}),s.jsx("span",{className:"s-host-gauge-rest","aria-hidden":"true",children:i.rest}),s.jsx("span",{className:"s-host-gauge-chrome","aria-hidden":"true",children:"]"})]}),s.jsx("span",{className:`s-host-rack-right font-mono ${o?"s-host-rack-age--warn":""} ${d||!h?"s-host-rack-dim":""}`,children:h?`${i.percent}%`:"—"}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono s-host-rack-truncate",children:f})]})}function se({navigate:a,agents:r}){const[o,d]=c.useState(null),[i,h]=c.useState(null),[m,f]=c.useState(null),[v,D]=c.useState(null),[z,ss]=c.useState(null),[L,es]=c.useState(null),[O,ts]=c.useState([]),[Ms,as]=c.useState(null),[V,ns]=c.useState([]),[Ts,rs]=c.useState([]),[Is,K]=c.useState(!0),[E,W]=c.useState(!1),[Cs,os]=c.useState(Date.now()),[G,Y]=c.useState("inquiry"),[ls,Ds]=c.useState(!1),[Ls,Os]=c.useState({"q-attention":!0,"q-dropped":!0,"q-quotas":!0,"q-posture":!0}),R=c.useCallback(async(e=!1)=>{e?W(!0):K(!0);try{const[t,n,l,k,P,p,N,M,B,q]=await Promise.allSettled([b("/.host-info"),b("/api/build"),b("/api/service-budgets"),b("/api/tail/discover"),b("/api/knowledge/status"),b("/api/pairing-state"),b("/api/terminal-sessions"),b("/api/fleet"),b("/api/sessions"),b("/api/activity")]);t.status==="fulfilled"&&d(t.value),n.status==="fulfilled"&&h(n.value),l.status==="fulfilled"?f(l.value?.gauges??[]):l.status==="rejected"&&f([]),k.status==="fulfilled"&&D(k.value),P.status==="fulfilled"&&ss(P.value),p.status==="fulfilled"&&es(p.value),N.status==="fulfilled"&&N.value?.sessions&&ts(N.value.sessions),M.status==="fulfilled"&&as(M.value),B.status==="fulfilled"&&Array.isArray(B.value)&&ns(B.value),q.status==="fulfilled"&&Array.isArray(q.value)&&rs(q.value),os(Date.now())}finally{K(!1),W(!1)}},[]);c.useEffect(()=>{R()},[R]),hs(()=>{R(!0)});const x=v?.processes??[],is=ls?x:x.slice(0,5);c.useMemo(()=>{const e={};for(const t of r){const n=t.harness||"other";e[n]||(e[n]={total:0,active:0}),e[n].total+=1,t.state==="working"&&(e[n].active+=1)}for(const t of x){const n=t.harness||"other";e[n]||(e[n]={total:0,active:0}),e[n].total=Math.max(e[n].total,1),e[n].active=Math.max(e[n].active,1)}return e},[r,x]);const $=c.useMemo(()=>{const e=new Map;for(const t of r){const n=t.projectRoot||t.cwd||"unknown";e.has(n)||e.set(n,{root:n,name:I(n),agents:[],branches:new Set,processes:[]});const l=e.get(n);l.agents.push(t),t.branch&&l.branches.add(t.branch)}for(const t of x)if(t.cwd)for(const[n,l]of e.entries())(t.cwd.startsWith(n)||n.startsWith(t.cwd))&&l.processes.push(t);return Array.from(e.values())},[r,x]),w=c.useMemo(()=>{const e=$.reduce((p,N)=>p+Math.max(1,N.agents.length+N.processes.length*3),0),t=$.map(p=>{const N=Math.max(1,p.agents.length+p.processes.length*3),M=e>0?Math.round(N/e*100):0;return{...p,weight:N,percent:M,primaryBranch:Array.from(p.branches)[0]||p.name==="openscout"&&i?.gitBranch||"main"}}).sort((p,N)=>N.weight-p.weight),n=t.slice(0,5),l=t[0],k=t.slice(5),P=k.reduce((p,N)=>p+N.percent,0);return{ranked:t,topProjects:n,topProject:l,otherProjects:k,otherPercent:P,totalProjects:t.length}},[$,i]),j=c.useMemo(()=>{const e=[];for(const t of x)if(t.command&&t.command.includes("--append-system-prompt")){const n=t.command.match(/session-[a-zA-Z0-9_-]+/),l=n?n[0]:`PID ${t.pid}`;e.push({id:`relay-${t.pid}`,kind:"stalled_relay",title:l,subtitle:`Launched in ${I(t.cwd)} · PID ${t.pid} · Runtime ${t.etime||"active"}`,ageLabel:t.etime||"active",ageSeconds:Rs(t.etime),projectRoot:t.cwd||void 0,harness:t.harness,pid:t.pid,severity:"warn",actionLabel:"Tail Process",actionRoute:{view:"ops",mode:"mission"}})}i?.gitBranch&&i.gitBranch!=="main"&&e.push({id:"branch-divergence",kind:"uncommitted_branch",title:i.gitBranch,subtitle:`Local worktree is ahead with uncommitted edits on ${i.runtime?.platform||"darwin"}`,ageLabel:"Unmerged",projectRoot:"/Users/art/dev/openscout",severity:"neutral",actionLabel:"Inspect Repos",actionRoute:{view:"repos"}});for(const t of V.slice(0,4))t.lastMessageAt&&Date.now()-t.lastMessageAt>3600*1e3&&e.push({id:`session-${t.id}`,kind:"unresumed_session",title:t.title||t.id,subtitle:`Last turn recorded ${C(t.lastMessageAt)} · ${t.messageCount} messages · ${I(t.workspaceRoot)}`,ageLabel:C(t.lastMessageAt),ageSeconds:(Date.now()-t.lastMessageAt)/1e3,conversationId:t.id,projectRoot:t.workspaceRoot||void 0,harness:t.harness||void 0,severity:"info",actionLabel:"Open Chat",actionRoute:{view:"conversation",conversationId:t.id}});return e},[x,i,V]),g=c.useMemo(()=>m?.length?[...m].sort((e,t)=>(t.fill??0)-(e.fill??0))[0]:null,[m]),u=c.useMemo(()=>{const e=w.ranked;if(e.length===0)return null;const t=e[0].percent,n=w.otherProjects;return{verdict:t>=50?"Concentrated":t>=25?"Weighted":"Scattered",topPercent:t,tailPercent:w.otherPercent,tailCount:n.length,tailAgents:n.reduce((l,k)=>l+k.agents.length,0),tailProcesses:n.reduce((l,k)=>l+k.processes.length,0),aboveTen:e.filter(l=>l.percent>=10).length}},[w]),y=c.useMemo(()=>{const e=j.reduce((n,l)=>(n[l.kind]=(n[l.kind]??0)+1,n),{}),t=j.map(n=>n.ageSeconds).filter(n=>typeof n=="number").sort((n,l)=>l-n)[0];return{verdict:j.length===0?"Nothing unattended":`${j.length} unattended`,byKind:e,oldestLabel:t?Z(t):null}},[j]),U=c.useMemo(()=>$s(m),[m]),A=c.useMemo(()=>{const e=O.length,t=z?.indexedSessions??0,n=L?.trustedPeerCount??0,l=o?.brokerUrl||(o?.ports?.broker?`127.0.0.1:${o.ports.broker}`:null);return[{key:"broker",label:"broker",detail:l?[l,o?.brokerSocketPath?As(o.brokerSocketPath):null].filter(Boolean).join(" · "):"endpoint not reported",state:l?"UP":"UNKNOWN",tone:l?"ok":"unknown"},{key:"pty",label:"pty relay",detail:e>0?`${e} socket${e===1?"":"s"}`:"0 sockets · latency unmeasured",state:e>0?"ACTIVE":"IDLE",tone:e>0?"ok":"idle"},{key:"knowledge",label:"knowledge",detail:t>0?`${t.toLocaleString()} transcript${t===1?"":"s"} indexed`:"0 transcripts indexed",state:t>0?"INDEXED":"EMPTY",tone:t>0?"ok":"warn",action:t>0?void 0:{label:"Index",route:{view:"search"}}},{key:"mesh",label:"mesh",detail:n>0?`${n} trusted peer${n===1?"":"s"} · scope ${o?.advertiseScope||"mesh"}`:`no trusted peers · scope ${o?.advertiseScope||"mesh"}`,state:n>0?"PAIRED":"UNPAIRED",tone:n>0?"ok":"idle"}]},[o,O,z,L]),Q=c.useMemo(()=>{const e=A.reduce((n,l)=>(n[l.tone]=(n[l.tone]??0)+1,n),{}),t=A.filter(n=>n.tone==="warn");return{verdict:t.length>0?`${t.length} ${t.length===1?"needs":"need"} attention`:"All nominal",figures:[e.ok?`${e.ok} up`:null,e.idle?`${e.idle} idle`:null,e.warn?`${e.warn} empty`:null,e.unknown?`${e.unknown} unknown`:null].filter(Boolean).join(" · ")}},[A]);o?.nodeName||o?.hostName;const cs=i?.runtime?`${i.runtime.platform} ${i.runtime.arch} · ${i.runtime.engine} ${i.runtime.engineVersion}`:"Darwin arm64";return s.jsxs("div",{className:"s-host-view",children:[s.jsxs("header",{className:"s-host-header",children:[s.jsxs("div",{className:"s-host-header-left",children:[s.jsxs("div",{className:"s-host-header-status-line",children:[s.jsx("span",{className:"dot dot--sm dot--working dot--pulse","aria-hidden":"true"}),s.jsxs("span",{className:"label-xs s-host-mono-dim",children:["NODE: ",o?.nodeId||"local"]}),s.jsx("span",{className:"s-host-header-divider",children:"/"}),s.jsx("span",{className:"label-xs s-host-mono-dim",children:cs}),i?.gitHash&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"s-host-header-divider",children:"/"}),s.jsxs("span",{className:"label-xs s-host-mono-dim",children:["git:",i.gitHash.slice(0,7)]})]})]}),s.jsxs("h1",{className:"s-host-title",children:[s.jsx(ms,{size:22,className:"s-host-title-icon"}),s.jsx("span",{children:"Host Advisor"})]})]}),s.jsxs("div",{className:"s-host-header-right",children:[s.jsxs("div",{className:"s-host-mode-toggle",role:"group","aria-label":"Advisor Format",children:[s.jsxs("button",{type:"button",className:`s-host-mode-btn ${G==="inquiry"?"s-host-mode-btn--active":""}`,onClick:()=>Y("inquiry"),title:"Formatted Executive Inquiries & Operator Answers",children:[s.jsx(us,{size:12}),s.jsx("span",{children:"Inquiries"})]}),s.jsxs("button",{type:"button",className:`s-host-mode-btn ${G==="matrix"?"s-host-mode-btn--active":""}`,onClick:()=>Y("matrix"),title:"Compact Infrastructure Matrix",children:[s.jsx(ps,{size:12}),s.jsx("span",{children:"Matrix"})]})]}),s.jsxs("button",{type:"button",className:`btn btn--sm ${E?"btn--accent":""}`,disabled:E,onClick:()=>{R(!0)},children:[s.jsx(xs,{size:12,className:E?"s-spin":""}),s.jsx("span",{children:E?"Scanning...":"Refresh"})]})]})]}),s.jsxs("section",{className:"s-host-readouts","aria-label":"Host Readouts",children:[s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"AGENTS"}),s.jsx("span",{className:"s-host-readout-figure",children:r.length}),s.jsxs("span",{className:"label-xs s-host-readout-qual",children:[x.length," PROCESS",x.length===1?"":"ES"]})]}),s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"ROOTS"}),s.jsx("span",{className:"s-host-readout-figure",children:$.length}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:u?`TOP SHARE ${u.topPercent}%`:"NONE ACTIVE"})]}),s.jsxs("div",{className:`s-host-readout ${g&&_(g)?"s-host-readout--warn":""}`,children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"PEAK BUDGET"}),s.jsx("span",{className:"s-host-readout-figure",children:g?`${Math.round((g.fill??0)*100)}%`:"—"}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:g?`${g.label}${g.resetAt?` · RESET ${C(g.resetAt)}`:""}`:"NO PROVIDERS CONFIGURED"})]}),s.jsxs("div",{className:`s-host-readout ${j.length>0?"s-host-readout--flag":""}`,children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"UNATTENDED"}),s.jsx("span",{className:"s-host-readout-figure",children:j.length}),s.jsx("span",{className:"label-xs s-host-readout-qual",children:y.oldestLabel?`OLDEST ${y.oldestLabel}`:"NONE OPEN"})]}),s.jsxs("div",{className:"s-host-readout",children:[s.jsx("span",{className:"label-xs s-host-readout-label",children:"MESH PEERS"}),s.jsx("span",{className:"s-host-readout-figure",children:L?.trustedPeerCount??0}),s.jsxs("span",{className:"label-xs s-host-readout-qual",children:["SCOPE ",(o?.advertiseScope||"mesh").toUpperCase()]})]})]}),G==="inquiry"?s.jsxs("div",{className:"s-host-readings","aria-label":"Host Readings",children:[s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"01 // ATTENTION"}),s.jsx("span",{className:"s-host-reading-verdict",children:u?.verdict??"No active roots"}),s.jsx("span",{className:"s-host-reading-figures",children:u?s.jsxs(s.Fragment,{children:["top ",u.topPercent,"%",s.jsx("span",{className:"s-host-sep",children:"·"}),"tail ",u.tailPercent,"%",s.jsx("span",{className:"s-host-sep",children:"·"}),u.aboveTen," root",u.aboveTen===1?"":"s"," above 10%"]}):s.jsx(s.Fragment,{children:"no agents or processes bound to a workspace"})}),s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"repos"}),children:[s.jsx("span",{children:"Repos"}),s.jsx(H,{size:10})]})]}),w.ranked.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"s-host-share-bar",children:[w.topProjects.map((e,t)=>s.jsx("div",{className:`s-host-share-seg s-host-share-seg--${Math.min(t,4)}`,style:{width:`${e.percent}%`},title:`${e.name} ${e.percent}%`,children:s.jsxs("span",{className:"s-host-share-seg-label font-mono text-2xs",children:[e.name," ",e.percent,"%"]})},e.root)),u&&u.tailCount>0&&s.jsx("div",{className:"s-host-share-seg s-host-share-seg--tail",style:{flex:1},children:s.jsxs("span",{className:"s-host-share-seg-label font-mono text-2xs",children:[u.tailCount," OTHER ROOTS — ",u.tailPercent,"%"]})})]}),s.jsxs("div",{className:"s-host-rack s-host-rack--roots",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs",children:"ROOT"}),s.jsx("span",{className:"label-xs",children:"SHARE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PCT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"AGENTS"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PROCS"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"BRANCH"})]}),w.topProjects.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:"s-host-rack-name font-mono",children:e.name}),s.jsx("span",{className:"s-host-rack-track",children:s.jsx("span",{className:"s-host-rack-fill",style:{width:`${u&&u.topPercent>0?Math.round(e.percent/u.topPercent*100):0}%`}})}),s.jsxs("span",{className:"s-host-rack-right font-mono",children:[e.percent,"%"]}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.agents.length}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.processes.length}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono s-host-rack-truncate",children:e.primaryBranch})]},e.root)),u&&u.tailCount>0&&s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--tail",children:[s.jsxs("span",{className:"s-host-rack-name font-mono",children:["tail — ",u.tailCount," roots"]}),s.jsx("span",{className:"s-host-rack-track s-host-rack-track--hatch"}),s.jsxs("span",{className:"s-host-rack-right font-mono",children:[u.tailPercent,"%"]}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:u.tailAgents}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:u.tailProcesses}),s.jsxs("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:["each below ",w.topProjects.at(-1)?.percent??0,"%"]})]})]})]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"02 // UNATTENDED"}),s.jsx("span",{className:"s-host-reading-verdict",children:y.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:j.length>0?s.jsxs(s.Fragment,{children:[y.oldestLabel&&s.jsxs(s.Fragment,{children:["oldest ",y.oldestLabel,s.jsx("span",{className:"s-host-sep",children:"·"})]}),Object.entries(y.byKind).map(([e,t])=>`${t} ${X[e]??e}`).join(" · "),s.jsx("span",{className:"s-host-sep",children:"·"}),"of ",x.length," processes"]}):s.jsx(s.Fragment,{children:"no idle relays, diverged branches or stale conversations"})})]}),j.length>0&&s.jsxs("div",{className:"s-host-rack s-host-rack--unattended",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs"}),s.jsx("span",{className:"label-xs",children:"SIGNAL"}),s.jsx("span",{className:"label-xs",children:"ROOT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"REF"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"AGE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"ACTION"})]}),j.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:`dot dot--sm ${e.severity==="warn"?"dot--warning":"dot--neutral"}`,"aria-hidden":"true"}),s.jsx("span",{className:"s-host-rack-name font-mono s-host-rack-truncate",children:e.title}),s.jsx("span",{className:"s-host-rack-dim font-mono s-host-rack-truncate",children:e.projectRoot?I(e.projectRoot):"—"}),s.jsx("span",{className:"s-host-rack-right s-host-rack-dim font-mono",children:e.pid?`pid ${e.pid}`:X[e.kind]??e.kind}),s.jsx("span",{className:`s-host-rack-right font-mono s-host-rack-age ${e.severity==="warn"?"s-host-rack-age--warn":""}`,children:e.ageSeconds?Z(e.ageSeconds):e.ageLabel}),s.jsx("span",{className:"s-host-rack-right s-host-rack-actions",children:e.actionRoute&&s.jsx("button",{type:"button",className:"btn btn--sm",onClick:()=>e.actionRoute&&a(e.actionRoute),children:e.actionLabel})})]},e.id))]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"03 // BUDGETS"}),s.jsx("span",{className:"s-host-reading-verdict",children:U.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:U.figures}),s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"harnesses"}),children:[s.jsx("span",{children:"Providers"}),s.jsx(H,{size:10})]})]}),U.showGauges&&m&&s.jsxs("div",{className:"s-host-rack s-host-rack--budgets",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs",children:"PROVIDER"}),s.jsx("span",{className:"label-xs",children:"GAUGE"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"PCT"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"NOTE"})]}),m.map(e=>s.jsx(Ps,{gauge:e},e.id))]})]}),s.jsxs("article",{className:"s-host-reading",children:[s.jsxs("div",{className:"s-host-reading-head",children:[s.jsx("span",{className:"label-xs s-host-reading-num",children:"04 // SUBSYSTEMS"}),s.jsx("span",{className:"s-host-reading-verdict",children:Q.verdict}),s.jsx("span",{className:"s-host-reading-figures",children:Q.figures})]}),s.jsxs("div",{className:"s-host-rack s-host-rack--subsystems",children:[s.jsxs("div",{className:"s-host-rack-row s-host-rack-row--head",children:[s.jsx("span",{className:"label-xs"}),s.jsx("span",{className:"label-xs",children:"SUBSYSTEM"}),s.jsx("span",{className:"label-xs",children:"DETAIL"}),s.jsx("span",{className:"label-xs s-host-rack-right",children:"STATE"})]}),A.map(e=>s.jsxs("div",{className:"s-host-rack-row",children:[s.jsx("span",{className:`dot dot--sm s-host-dot--${e.tone}`,"aria-hidden":"true"}),s.jsx("span",{className:"s-host-rack-name font-mono",children:e.label}),s.jsx("span",{className:"s-host-rack-dim font-mono s-host-rack-truncate",children:e.detail}),s.jsxs("span",{className:"s-host-rack-right s-host-rack-actions",children:[e.action&&s.jsx("button",{type:"button",className:"btn btn--sm s-host-btn-accent",onClick:()=>e.action&&a(e.action.route),children:e.action.label}),s.jsx("span",{className:`chip chip--sm chip--mono s-host-state s-host-state--${e.tone}`,children:e.state})]})]},e.key))]})]})]}):s.jsxs("div",{className:"s-host-matrix-container",children:[s.jsxs("section",{className:"s-host-telemetry-grid","aria-label":"Host Telemetry Overview",children:[s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"REGISTERED AGENTS"}),s.jsx(Ns,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:r.length}),s.jsxs("span",{className:"s-host-stat-kicker",children:[x.length," background processes"]})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"SERVICE QUOTA RADAR"}),s.jsx(fs,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:g?`${Math.round((g.fill??0)*100)}%`:"Nominal"}),s.jsx("span",{className:"s-host-stat-kicker",children:"peak token consumption"})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"WORKSPACES & REPOS"}),s.jsx(ks,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:$.length}),s.jsx("span",{className:"s-host-stat-kicker",children:"registered project roots"})]})]}),s.jsxs("div",{className:"s-host-stat-box",children:[s.jsxs("div",{className:"s-host-stat-head",children:[s.jsx("span",{className:"label-xs s-host-stat-label",children:"SUBSYSTEM RELAYS"}),s.jsx(js,{size:13,className:"s-host-stat-icon"})]}),s.jsxs("div",{className:"s-host-stat-body",children:[s.jsx("span",{className:"s-host-stat-big",children:O.length}),s.jsx("span",{className:"s-host-stat-kicker",children:"live terminal relays"})]})]})]}),s.jsxs("section",{className:"s-host-block","aria-label":"Active Processes",children:[s.jsx("div",{className:"s-host-block-head",children:s.jsxs("span",{className:"label-xs",children:["ACTIVE HARNESS PROCESSES (",x.length,")"]})}),s.jsx("div",{className:"s-host-table-box",children:s.jsx("div",{className:"s-host-table",children:is.map(e=>s.jsxs("div",{className:"s-host-table-row",children:[s.jsxs("div",{className:"s-host-table-cell-main",children:[s.jsx("span",{className:"dot dot--sm dot--working dot--pulse","aria-hidden":"true"}),s.jsx(ds,{harness:e.harness,size:13}),s.jsx("span",{className:"font-semibold text-xs font-mono",children:Es(e.command,e.harness)}),s.jsxs("span",{className:"chip chip--sm chip--ghost chip--mono",children:["PID ",e.pid]}),e.etime&&s.jsx("span",{className:"chip chip--sm chip--ghost chip--mono",children:e.etime})]}),s.jsx("div",{className:"s-host-table-cell-action",children:s.jsxs("button",{type:"button",className:"btn btn--sm",onClick:()=>a({view:"ops",mode:"mission"}),children:[s.jsx("span",{children:"Tail"}),s.jsx(H,{size:10})]})})]},e.pid))})})]})]})]})}export{se as HostAdvisorView};
|